mirror of
https://github.com/StarCitizenTools/mediawiki-extensions-TabberNeue.git
synced 2024-11-24 00:13:28 +00:00
refactor: drop spread syntax for iterating nodeList
This commit is contained in:
parent
9162321c3c
commit
78a987d7c1
|
@ -415,15 +415,19 @@ class TabberEvent {
|
||||||
const tabpanels = tabberEl.querySelectorAll( ':scope > .tabber__section > .tabber__panel' );
|
const tabpanels = tabberEl.querySelectorAll( ':scope > .tabber__section > .tabber__panel' );
|
||||||
const tabs = tabberEl.querySelectorAll( ':scope > .tabber__header > .tabber__tabs > .tabber__tab' );
|
const tabs = tabberEl.querySelectorAll( ':scope > .tabber__header > .tabber__tabs > .tabber__tab' );
|
||||||
|
|
||||||
[ ...tabpanels ].forEach( ( tabpanel ) => {
|
tabpanels.forEach( ( tabpanel ) => {
|
||||||
tabpanel.setAttribute( 'aria-hidden', 'true' );
|
tabpanel.setAttribute( 'aria-hidden', 'true' );
|
||||||
if ( typeof resizeObserver !== 'undefined' && resizeObserver ) {
|
if ( typeof resizeObserver !== 'undefined' && resizeObserver ) {
|
||||||
resizeObserver.unobserve( tabpanel );
|
resizeObserver.unobserve( tabpanel );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
[ ...tabs ].forEach( ( tab ) => {
|
tabs.forEach( ( tab ) => {
|
||||||
tab.setAttribute( 'aria-selected', 'false' );
|
const tabAttributes = {
|
||||||
|
'aria-selected': false,
|
||||||
|
tabindex: '-1'
|
||||||
|
};
|
||||||
|
Util.setAttributes( tab, tabAttributes );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Ensure `resizeObserver` is defined before using it
|
// Ensure `resizeObserver` is defined before using it
|
||||||
|
@ -432,6 +436,7 @@ class TabberEvent {
|
||||||
}
|
}
|
||||||
activeTabpanel.setAttribute( 'aria-hidden', 'false' );
|
activeTabpanel.setAttribute( 'aria-hidden', 'false' );
|
||||||
activeTab.setAttribute( 'aria-selected', 'true' );
|
activeTab.setAttribute( 'aria-selected', 'true' );
|
||||||
|
activeTab.setAttribute( 'tabindex', '0' );
|
||||||
|
|
||||||
TabberEvent.updateIndicator( tabberEl, activeTab );
|
TabberEvent.updateIndicator( tabberEl, activeTab );
|
||||||
TabberEvent.setActiveTabpanel( activeTabpanel );
|
TabberEvent.setActiveTabpanel( activeTabpanel );
|
||||||
|
@ -648,7 +653,7 @@ class TabberBuilder {
|
||||||
createTabs() {
|
createTabs() {
|
||||||
const fragment = document.createDocumentFragment();
|
const fragment = document.createDocumentFragment();
|
||||||
const tabpanels = this.tabber.querySelectorAll( ':scope > .tabber__section > .tabber__panel' );
|
const tabpanels = this.tabber.querySelectorAll( ':scope > .tabber__section > .tabber__panel' );
|
||||||
[ ...tabpanels ].forEach( ( tabpanel ) => {
|
tabpanels.forEach( ( tabpanel ) => {
|
||||||
fragment.append( this.createTabElement( tabpanel ) );
|
fragment.append( this.createTabElement( tabpanel ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue