Bartosz Dziewoński has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/386415 )
Change subject: DropdownWidget: Allow pressing Space to close the widget, as
well as open
......................................................................
DropdownWidget: Allow pressing Space to close the widget, as well as open
For any other widget with keyboard handling we treat Space and Enter
the same. This was an exception because Space conflicted with
type-to-search (see 2650383e), but I think I managed to solve that.
(The old code was additionally problematic because since 7e442e09
we allow type-to-search even when the menu is closed, so it would
suddenly pop open when you typed a space.)
Change-Id: I44b98c63d026630350c975eeb5ef2616c3b31717
---
M src/widgets/DropdownWidget.js
1 file changed, 6 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/15/386415/1
diff --git a/src/widgets/DropdownWidget.js b/src/widgets/DropdownWidget.js
index 22f8745..ca96223 100644
--- a/src/widgets/DropdownWidget.js
+++ b/src/widgets/DropdownWidget.js
@@ -189,9 +189,14 @@
(
e.which === OO.ui.Keys.ENTER ||
(
+ e.which === OO.ui.Keys.SPACE &&
+ // Avoid conflicts with type-to-search, see
SelectWidget#onKeyPress.
+ // Space only closes the menu is the user is
not typing to search.
+ this.menu.keyPressBuffer === ''
+ ) ||
+ (
!this.menu.isVisible() &&
(
- e.which === OO.ui.Keys.SPACE ||
e.which === OO.ui.Keys.UP ||
e.which === OO.ui.Keys.DOWN
)
--
To view, visit https://gerrit.wikimedia.org/r/386415
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I44b98c63d026630350c975eeb5ef2616c3b31717
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits