[Accessibility] Add ability for a screen reader to announce the current tab on a sing… (#50373)
Add ability for a screen reader to announce the current tab on a single product page. Co-authored-by: amesplant <95257231+amesplant-dmv@users.noreply.github.com>
This commit is contained in:
parent
94f6ec5ccc
commit
2d8bd64c54
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: fix
|
||||||
|
|
||||||
|
Add ability for a screen reader to announce the current tab on a single product page.
|
|
@ -31,9 +31,11 @@ jQuery( function( $ ) {
|
||||||
var $tabs_wrapper = $tab.closest( '.wc-tabs-wrapper, .woocommerce-tabs' );
|
var $tabs_wrapper = $tab.closest( '.wc-tabs-wrapper, .woocommerce-tabs' );
|
||||||
var $tabs = $tabs_wrapper.find( '.wc-tabs, ul.tabs' );
|
var $tabs = $tabs_wrapper.find( '.wc-tabs, ul.tabs' );
|
||||||
|
|
||||||
|
$tabs.find( 'li' ).attr( 'aria-selected', 'false' );
|
||||||
$tabs.find( 'li' ).removeClass( 'active' );
|
$tabs.find( 'li' ).removeClass( 'active' );
|
||||||
$tabs_wrapper.find( '.wc-tab, .panel:not(.panel .panel)' ).hide();
|
$tabs_wrapper.find( '.wc-tab, .panel:not(.panel .panel)' ).hide();
|
||||||
|
|
||||||
|
$tab.closest( 'li' ).attr( 'aria-selected', 'true' );
|
||||||
$tab.closest( 'li' ).addClass( 'active' );
|
$tab.closest( 'li' ).addClass( 'active' );
|
||||||
$tabs_wrapper.find( '#' + $tab.attr( 'href' ).split( '#' )[1] ).show();
|
$tabs_wrapper.find( '#' + $tab.attr( 'href' ).split( '#' )[1] ).show();
|
||||||
} )
|
} )
|
||||||
|
|
Loading…
Reference in New Issue