Fix: focus order and screen reader issue in help popup dialog

Bug: T257175
Change-Id: Ib1e72caf06de827d5867e2badfd16408d32e9593
This commit is contained in:
Akinwale Alagbe 2020-04-02 01:24:16 -07:00 committed by Bartosz Dziewoński
parent ed2cfe8fd2
commit 92f2fb1522

View file

@ -24,6 +24,11 @@ ve.ui.MWPopupTool = function VeUiMWPopupTool( title, toolGroup, config ) {
// Parent constructor
ve.ui.MWPopupTool.super.call( this, toolGroup, config );
this.popup.connect( this, {
ready: 'onPopupOpened',
closing: 'onPopupClosing'
} );
this.$element.addClass( 've-ui-mwPopupTool' );
this.$link.on( 'click', this.onToolLinkClick.bind( this ) );
@ -33,6 +38,20 @@ ve.ui.MWPopupTool = function VeUiMWPopupTool( title, toolGroup, config ) {
OO.inheritClass( ve.ui.MWPopupTool, OO.ui.PopupTool );
/**
* Handle to call when popup is opened.
*/
ve.ui.MWPopupTool.prototype.onPopupOpened = function () {
this.popup.closeButton.focus();
};
/**
* Handle to call when popup is closing
*/
ve.ui.MWPopupTool.prototype.onPopupClosing = function () {
this.$link.trigger( 'focus' );
};
/**
* Handle clicks on the main tool button.
*
@ -193,6 +212,7 @@ ve.ui.MWHelpPopupTool = function VeUiMWHelpPopupTool( toolGroup, config ) {
);
ve.targetLinksToNewWindow( this.$items[ 0 ] );
this.popup.$body.append( this.$items );
this.popup.$element.attr( 'aria-label', ve.msg( 'visualeditor-help-tool' ) );
};
/* Inheritance */