Prtksxna has uploaded a new change for review.
https://gerrit.wikimedia.org/r/232006
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, 19 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/06/232006/1
diff --git a/src/dialogs/MessageDialog.js b/src/dialogs/MessageDialog.js
index f295cda..7b516cc 100644
--- a/src/dialogs/MessageDialog.js
+++ b/src/dialogs/MessageDialog.js
@@ -194,6 +194,24 @@
/**
* @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.filter( function ( action ) {
+ return action.getFlags().indexOf( 'primary' ) >
-1;
+ } );
+ actions[0].$button.focus();
+ }, this );
+};
+
+/**
+ * @inheritdoc
+ */
OO.ui.MessageDialog.prototype.getBodyHeight = function () {
var bodyHeight, oldOverflow,
$scrollable = this.container.$element;
@@ -270,6 +288,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: newchange
Gerrit-Change-Id: Iaeb39e82494fc68d7884018214a1d7fc163df0a9
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Prtksxna <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits