Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Menu: Added focusing first menu item when menu receives focus and collapseAll when menu loses focus (blur). #406

Merged
merged 1 commit into from

2 participants

Kris Borchers Jörn Zaefferer
Kris Borchers
Owner

Menu: Added focusing first menu item when menu receives focus and collapseAll when menu loses focus (blur).

Jörn Zaefferer jzaefferer merged commit e16e99a into from
Jörn Zaefferer
Owner

Thanks, landed! Improves the keyboard interaction with inline menus a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 26, 2011
  1. Kris Borchers

    Menu: Added focusing first menu item when menu receives focus and col…

    kborchers authored
    …lapseAll when menu loses focus (blur).
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 0 deletions.
  1. +12 −0 ui/jquery.ui.menu.js
12 ui/jquery.ui.menu.js
View
@@ -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();
Something went wrong with that request. Please try again.