aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkborchers <k_borchers@yahoo.com>2011-07-26 08:52:33 -0500
committerkborchers <k_borchers@yahoo.com>2011-07-26 08:52:33 -0500
commite16e99a154d7f3bdbc7ffe56e5c74e9fe90bbd6b (patch)
treee11be54a721065273263d3773b5893ef8d8638f2
parentf89091105facf5760644565925a7578bd2232ded (diff)
downloadjquery-ui-e16e99a154d7f3bdbc7ffe56e5c74e9fe90bbd6b.tar.gz
jquery-ui-e16e99a154d7f3bdbc7ffe56e5c74e9fe90bbd6b.zip
Menu: Added focusing first menu item when menu receives focus and collapseAll when menu loses focus (blur).
-rw-r--r--ui/jquery.ui.menu.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index ad7a9c8c1..c55ae75c9 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -71,6 +71,18 @@ $.widget( "ui.menu", {
if ( target.length ) {
self.blur( event );
}
+ })
+ .bind( "focus.menu", function( event ) {
+ if ( self.options.disabled ) {
+ return;
+ }
+ self.focus( event, $( event.target ).children( ".ui-menu-item:first" ) );
+ })
+ .bind( "blur.menu", function( event ) {
+ if ( self.options.disabled ) {
+ return;
+ }
+ self.collapseAll( event );
});
this.refresh();