Skip to content

Commit 7d5ed41

Browse files
committed
Make container role=presentation
The current `<tab-container>` is generic role, which is fine except for it makes for a messier AT than necessary. The `<tab-container>` itself _is_ a presentational element (the real AT relevant elements are the tablist, tabs, and panels), so this change makes that explicit by setting role=presentation to the tab-container.
1 parent 591533f commit 7d5ed41

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/tab-container-element.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ export class TabContainerElement extends HTMLElement {
119119
panelSlot.setAttribute('role', 'presentation')
120120
shadowRoot.replaceChildren(tabListSlot, panelSlot)
121121

122+
if (this.#internals && 'role' in this.#internals) {
123+
this.#internals.role = 'presentation'
124+
} else {
125+
this.setAttribute('role', 'presentation')
126+
}
127+
122128
this.addEventListener('keydown', this)
123129
this.addEventListener('click', this)
124130
this.selectTab(

0 commit comments

Comments
 (0)