Skip to content

Commit e6a75c9

Browse files
committed
Fixes tablist-tab-wrapper accessibility violation by reverting div->slot change
1 parent ce86c9b commit e6a75c9

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/tab-container-element.ts

+4-12
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class TabContainerElement extends HTMLElement {
110110
static observedAttributes = ['vertical']
111111

112112
get #tabList() {
113-
const wrapper = this.querySelector('[slot=tablist-wrapper],[slot=tablist-tab-wrapper]')
113+
const wrapper = this.querySelector('[slot=tablist-wrapper]')
114114
if (wrapper?.closest(this.tagName) === this) {
115115
return wrapper.querySelector('[role=tablist]') as HTMLElement
116116
}
@@ -127,7 +127,7 @@ export class TabContainerElement extends HTMLElement {
127127
}
128128

129129
get #tabListTabWrapper() {
130-
return this.shadowRoot!.querySelector<HTMLSlotElement>('slot[part="tablist-tab-wrapper"]')!
130+
return this.shadowRoot!.querySelector<HTMLElement>('div[part="tablist-tab-wrapper"]')!
131131
}
132132

133133
get #beforeTabsSlot() {
@@ -189,7 +189,7 @@ export class TabContainerElement extends HTMLElement {
189189
tabListContainer.style.display = 'flex'
190190
tabListContainer.setAttribute('part', 'tablist-wrapper')
191191
tabListContainer.setAttribute('name', 'tablist-wrapper')
192-
const tabListTabWrapper = document.createElement('slot')
192+
const tabListTabWrapper = document.createElement('div')
193193
tabListTabWrapper.setAttribute('part', 'tablist-tab-wrapper')
194194
tabListTabWrapper.setAttribute('name', 'tablist-tab-wrapper')
195195
const tabListSlot = document.createElement('slot')
@@ -299,14 +299,10 @@ export class TabContainerElement extends HTMLElement {
299299
if (!this.#setupComplete) {
300300
const tabListSlot = this.#tabListSlot
301301
const tabListWrapper = this.#tabListWrapper
302-
const tabListTabWrapper = this.#tabListTabWrapper
303302
const customTabList = this.querySelector('[role=tablist]')
304303
const customTabListWrapper = this.querySelector('[slot=tablist-wrapper]')
305-
const customTabListTabWrapper = this.querySelector('[slot=tablist-tab-wrapper]')
306304
if (customTabListWrapper && customTabListWrapper.closest(this.tagName) === this) {
307305
assignSlotWithFallback(tabListWrapper, customTabListWrapper)
308-
} else if (customTabListTabWrapper && customTabListTabWrapper.closest(this.tagName) === this) {
309-
assignSlotWithFallback(tabListTabWrapper, customTabListTabWrapper)
310306
} else if (customTabList && customTabList.closest(this.tagName) === this) {
311307
assignSlotWithFallback(tabListSlot, customTabList)
312308
} else {
@@ -326,11 +322,7 @@ export class TabContainerElement extends HTMLElement {
326322
const afterSlotted: Element[] = []
327323
let autoSlotted = beforeSlotted
328324
for (const child of this.children) {
329-
if (
330-
child.getAttribute('role') === 'tab' ||
331-
child.getAttribute('role') === 'tablist' ||
332-
child.getAttribute('slot') === 'tablist-tab-wrapper'
333-
) {
325+
if (child.getAttribute('role') === 'tab' || child.getAttribute('role') === 'tablist') {
334326
autoSlotted = afterTabSlotted
335327
continue
336328
}

0 commit comments

Comments
 (0)