Accessibility: Media: Improve the logic to render the ARIA tabs markup after [46363].

Additionally checks for the "menu" and "router" state attributes to better determine when the ARIA tabs pattern markup is appropriate.

See #47149.


git-svn-id: https://develop.svn.wordpress.org/trunk@46438 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia 2019-10-08 17:05:53 +00:00
parent 1f6dbef069
commit fb0d0e20ab

View File

@ -103,7 +103,7 @@ MediaFrame = Frame.extend(/** @lends wp.media.view.MediaFrame.prototype */{
tabPanelEl.removeAttr( 'role aria-labelledby tabindex' ); tabPanelEl.removeAttr( 'role aria-labelledby tabindex' );
if ( this.menuView && this.menuView.isVisible ) { if ( this.state().get( 'menu' ) && this.menuView && this.menuView.isVisible ) {
ariaLabelledby = 'menu-item-' + stateId; ariaLabelledby = 'menu-item-' + stateId;
// Set the tab panel attributes only if the tabs are visible. // Set the tab panel attributes only if the tabs are visible.
@ -129,13 +129,8 @@ MediaFrame = Frame.extend(/** @lends wp.media.view.MediaFrame.prototype */{
tabPanelEl.removeAttr( 'role aria-labelledby tabindex' ); tabPanelEl.removeAttr( 'role aria-labelledby tabindex' );
// On the Embed view the router menu is hidden.
if ( 'embed' === this.content._mode ) {
return;
}
// Set the tab panel attributes only if the tabs are visible. // Set the tab panel attributes only if the tabs are visible.
if ( this.routerView && this.routerView.isVisible && this.content._mode ) { if ( this.state().get( 'router' ) && this.routerView && this.routerView.isVisible && this.content._mode ) {
ariaLabelledby = 'menu-item-' + this.content._mode; ariaLabelledby = 'menu-item-' + this.content._mode;
tabPanelEl tabPanelEl