Skip to content

Commit 9bbe75a

Browse files
asyncLizcopybara-github
authored andcommitted
docs: fix tab's change event description for active tab properties
Fixes #5610 PiperOrigin-RevId: 636773653
1 parent 0509c86 commit 9bbe75a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

docs/components/tabs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ Method | Parameters | Returns | Description
402402

403403
Event | Description
404404
--- | ---
405-
`change` | Fired when the selected tab changes. The target's selected or selectedItem and previousSelected or previousSelectedItem provide information about the selection change. The change event is fired when a user interaction like a space/enter key or click cause a selection change. The tab selection based on these actions can be cancelled by calling preventDefault on the triggering `keydown` or `click` event.
405+
`change` | Fired when the selected tab changes. The target's `activeTabIndex` or `activeTab` provide information about the selection change. The change event is fired when a user interaction like a space/enter key or click cause a selection change. The tab selection based on these actions can be cancelled by calling preventDefault on the triggering `keydown` or `click` event.
406406

407407
<!-- mdformat on(autogenerated might break rendering in catalog) -->
408408

tabs/internal/tabs.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ import {property, query, queryAssignedElements} from 'lit/decorators.js';
1212
import {ANIMATE_INDICATOR, Tab} from './tab.js';
1313

1414
/**
15-
* @fires change {Event} Fired when the selected tab changes. The target's selected or
16-
* selectedItem and previousSelected or previousSelectedItem provide information
17-
* about the selection change. The change event is fired when a user interaction
18-
* like a space/enter key or click cause a selection change. The tab selection
19-
* based on these actions can be cancelled by calling preventDefault on the
20-
* triggering `keydown` or `click` event. --bubbles
15+
* @fires change {Event} Fired when the selected tab changes. The target's
16+
* `activeTabIndex` or `activeTab` provide information about the selection
17+
* change. The change event is fired when a user interaction like a space/enter
18+
* key or click cause a selection change. The tab selection based on these
19+
* actions can be cancelled by calling preventDefault on the triggering
20+
* `keydown` or `click` event. --bubbles
2121
*
2222
* @example
2323
* // perform an action if a tab is clicked
2424
* tabs.addEventListener('change', (event: Event) => {
25-
* if (event.target.selected === 2)
26-
* takeAction();
25+
* if (event.target.activeTabIndex === 2)
26+
* takeAction();
2727
* }
2828
* });
2929
*
3030
* // prevent a click from triggering tab selection under some condition
3131
* tabs.addEventListener('click', (event: Event) => {
3232
* if (notReady)
33-
* event.preventDefault();
33+
* event.preventDefault();
3434
* }
3535
* });
3636
*

0 commit comments

Comments
 (0)