From fb0d0e20ab5337df38ef89b1cbdc58e0a947a3cd Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Tue, 8 Oct 2019 17:05:53 +0000 Subject: [PATCH] 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 --- src/js/media/views/media-frame.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/js/media/views/media-frame.js b/src/js/media/views/media-frame.js index b51177cfca..4866e62f2e 100644 --- a/src/js/media/views/media-frame.js +++ b/src/js/media/views/media-frame.js @@ -103,7 +103,7 @@ MediaFrame = Frame.extend(/** @lends wp.media.view.MediaFrame.prototype */{ 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; // 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' ); - // 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. - 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; tabPanelEl