Skip to content

Commit f7e8331

Browse files
committed
Popup: Improve key handling
1 parent 2cf85da commit f7e8331

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/visual/menu/popup.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ $.widget( "ui.popup", {
3838

3939
this._bind(this.options.trigger, {
4040
keydown: function( event ) {
41-
// prevent space-to-open to scroll the page
42-
// TODO do this only for a:ui-button?
43-
if (event.keyCode == $.ui.keyCode.SPACE) {
41+
// prevent space-to-open to scroll the page, only hapens for anchor ui.button
42+
if ($( event.currentTarget ).is( "a:ui-button" ) && event.keyCode == $.ui.keyCode.SPACE) {
4443
event.preventDefault()
4544
}
46-
// TODO handle keydown to open popup?
47-
//if (event.keyCode == $.ui.keyCode.SPACE) { .. }
45+
// TODO handle keydown to open popup? only when not handled by ui.button
46+
//if (event.keyCode == $.ui.keyCode.SPACE) {
47+
//}
4848
},
4949
click: function( event ) {
5050
event.preventDefault();

0 commit comments

Comments
 (0)