diff --git a/modules/ext.tabberNeue.js b/modules/ext.tabberNeue.js index e38450d..48a83c9 100644 --- a/modules/ext.tabberNeue.js +++ b/modules/ext.tabberNeue.js @@ -5,7 +5,7 @@ * @param {number} count */ function initTabber( tabber, count ) { - var ACTIVETABCLASS = 'tabber__tab--active'; + var ACTIVETAB_SELECTOR = '[aria-selected="true"]'; var tabPanels = tabber.querySelectorAll( ':scope > .tabber__section > .tabber__panel' ); @@ -119,7 +119,7 @@ function initTabber( tabber, count ) { }; var updateIndicator = function () { - var activeTab = tabList.querySelector( '.' + ACTIVETABCLASS ); + var activeTab = tabList.querySelector( ACTIVETAB_SELECTOR ); var width = getActualSize( activeTab, 'width' ); indicator.style.width = width + 'px'; @@ -280,13 +280,12 @@ function initTabber( tabber, count ) { /* eslint-disable mediawiki/class-doc */ if ( activePanel ) { - // Just to be safe since there can be multiple active classes + // Just to be safe since there can be multiple active tabs // even if there shouldn't be - var activeTabs = tabList.querySelectorAll( '.' + ACTIVETABCLASS ); + var activeTabs = tabList.querySelectorAll( ACTIVETAB_SELECTOR ); if ( activeTabs.length > 0 ) { Array.prototype.forEach.call( activeTabs, function ( activeTab ) { - activeTab.classList.remove( ACTIVETABCLASS ); activeTab.setAttribute( 'aria-selected', false ); } ); } @@ -300,7 +299,6 @@ function initTabber( tabber, count ) { } // Add active class to the tab - targetTab.classList.add( ACTIVETABCLASS ); targetTab.setAttribute( 'aria-selected', true ); targetPanel.classList.add( ACTIVEPANELCLASS ); targetPanel.setAttribute( 'aria-hidden', false ); diff --git a/modules/ext.tabberNeue.less b/modules/ext.tabberNeue.less index d7a013d..7c79de6 100644 --- a/modules/ext.tabberNeue.less +++ b/modules/ext.tabberNeue.less @@ -92,10 +92,10 @@ } &__indicator { + border-radius: @height-indicator; margin-top: @height-indicator * -1; background: #36c; block-size: @height-indicator; - border-radius: @height-indicator; inline-size: 0; } @@ -128,8 +128,8 @@ text-decoration: none; } - &--active, - &--active:visited { + &[ aria-selected='true' ], + &[ aria-selected='true' ]:visited { color: #36c; } }