jenkins-bot has submitted this change and it was merged.
Change subject: DropdownWidget: Open menu on up and down arrow keys
......................................................................
DropdownWidget: Open menu on up and down arrow keys
Bug: T124825
Change-Id: I2e7b78a0eba612470176f7f7c78289fe057205a8
---
M src/widgets/DropdownWidget.js
1 file changed, 17 insertions(+), 6 deletions(-)
Approvals:
Bartosz Dziewoński: Looks good to me, approved
Jforrester: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/src/widgets/DropdownWidget.js b/src/widgets/DropdownWidget.js
index 824a783..a5d8e7e 100644
--- a/src/widgets/DropdownWidget.js
+++ b/src/widgets/DropdownWidget.js
@@ -80,7 +80,7 @@
// Events
this.$handle.on( {
click: this.onClick.bind( this ),
- keypress: this.onKeyPress.bind( this )
+ keydown: this.onKeyDown.bind( this )
} );
this.menu.connect( this, { select: 'onMenuSelect' } );
@@ -152,14 +152,25 @@
};
/**
- * Handle key press events.
+ * Handle key down events.
*
* @private
- * @param {jQuery.Event} e Key press event
+ * @param {jQuery.Event} e Key down event
*/
-OO.ui.DropdownWidget.prototype.onKeyPress = function ( e ) {
- if ( !this.isDisabled() &&
- ( ( e.which === OO.ui.Keys.SPACE && !this.menu.isVisible() ) ||
e.which === OO.ui.Keys.ENTER )
+OO.ui.DropdownWidget.prototype.onKeyDown = function ( e ) {
+ if (
+ !this.isDisabled() &&
+ (
+ e.which === OO.ui.Keys.ENTER ||
+ (
+ !this.menu.isVisible() &&
+ (
+ e.which === OO.ui.Keys.SPACE ||
+ e.which === OO.ui.Keys.UP ||
+ e.which === OO.ui.Keys.DOWN
+ )
+ )
+ )
) {
this.menu.toggle();
return false;
--
To view, visit https://gerrit.wikimedia.org/r/269072
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2e7b78a0eba612470176f7f7c78289fe057205a8
Gerrit-PatchSet: 3
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: Prtksxna <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits