jenkins-bot has submitted this change and it was merged.

Change subject: MessageDialog: Focus primary action button when the dialog opens
......................................................................


MessageDialog: Focus primary action button when the dialog opens

Bug: T104612
Change-Id: Iaeb39e82494fc68d7884018214a1d7fc163df0a9
---
M src/dialogs/MessageDialog.js
1 file changed, 21 insertions(+), 0 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/dialogs/MessageDialog.js b/src/dialogs/MessageDialog.js
index f295cda..fb3c37e 100644
--- a/src/dialogs/MessageDialog.js
+++ b/src/dialogs/MessageDialog.js
@@ -194,6 +194,26 @@
 /**
  * @inheritdoc
  */
+OO.ui.MessageDialog.prototype.getReadyProcess = function ( data ) {
+       data = data || {};
+
+       // Parent method
+       return OO.ui.MessageDialog.parent.prototype.getReadyProcess.call( this, 
data )
+               .next( function () {
+                       // Focus the primary action button
+                       var actions = this.actions.get();
+                       actions = actions.filter( function ( action ) {
+                               return action.getFlags().indexOf( 'primary' ) > 
-1;
+                       } );
+                       if ( actions.length > 0 ) {
+                               actions[0].$button.focus();
+                       }
+               }, this );
+};
+
+/**
+ * @inheritdoc
+ */
 OO.ui.MessageDialog.prototype.getBodyHeight = function () {
        var bodyHeight, oldOverflow,
                $scrollable = this.container.$element;
@@ -270,6 +290,7 @@
 
        special = this.actions.getSpecial();
        others = this.actions.getOthers();
+
        if ( special.safe ) {
                this.$actions.append( special.safe.$element );
                special.safe.toggleFramed( false );

-- 
To view, visit https://gerrit.wikimedia.org/r/232006
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaeb39e82494fc68d7884018214a1d7fc163df0a9
Gerrit-PatchSet: 2
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Prtksxna <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to