aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.menu.js
diff options
context:
space:
mode:
authorDan Wellman <danwellman@hotmail.com>2011-11-28 08:38:34 +0000
committerDan Wellman <danwellman@hotmail.com>2011-11-28 08:38:34 +0000
commita4fd5449b24b998ffa514f01b735da2b6465a80a (patch)
tree51b1c2828e85f538775e22cf5e3a930a8c4fe506 /ui/jquery.ui.menu.js
parentfce4725a8ac599efab5449710550a029a2d6fbe3 (diff)
parent53ea93327e9040b7472e8fd2af2abaea19058e4a (diff)
downloadjquery-ui-a4fd5449b24b998ffa514f01b735da2b6465a80a.tar.gz
jquery-ui-a4fd5449b24b998ffa514f01b735da2b6465a80a.zip
Merge remote-tracking branch 'upstream/selectmenu' into selectmenu
Diffstat (limited to 'ui/jquery.ui.menu.js')
-rw-r--r--ui/jquery.ui.menu.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index bf36a77fe..4fe859f4e 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -40,16 +40,6 @@ $.widget( "ui.menu", {
id: this.menuId,
role: "menu"
})
- // Prevent focus from sticking to links inside menu after clicking
- // them (focus should always stay on UL during navigation).
- // If the link is clicked, redirect focus to the menu.
- // TODO move to _bind below
- .bind( "mousedown.menu", function( event ) {
- if ( $( event.target).is( "a" ) ) {
- event.preventDefault();
- $( this ).focus( 1 );
- }
- })
// need to catch all clicks on disabled menu
// not possible through _bind
.bind( "click.menu", $.proxy( function( event ) {
@@ -58,6 +48,11 @@ $.widget( "ui.menu", {
}
}, this));
this._bind({
+ // Prevent focus from sticking to links inside menu after clicking
+ // them (focus should always stay on UL during navigation).
+ "mousedown .ui-menu-item > a": function( event ) {
+ event.preventDefault();
+ },
"click .ui-menu-item:has(a)": function( event ) {
event.stopImmediatePropagation();
var target = $( event.currentTarget );
@@ -66,6 +61,8 @@ $.widget( "ui.menu", {
this.focus( event, target );
}
this.select( event );
+ // Redirect focus to the menu.
+ this.element.focus();
},
"mouseover .ui-menu-item": function( event ) {
event.stopImmediatePropagation();