Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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

Merged
merged 1 commit into from almost 3 years ago

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

Showing 1 unique commit by 1 author.

Jul 26, 2011
Kris Borchers kborchers Menu: Added focusing first menu item when menu receives focus and col…
…lapseAll when menu loses focus (blur).
e16e99a
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 12 additions and 0 deletions. Show diff stats Hide diff stats

  1. +12 0 ui/jquery.ui.menu.js
12 ui/jquery.ui.menu.js
@@ -71,6 +71,18 @@ $.widget( "ui.menu", {
71 71 if ( target.length ) {
72 72 self.blur( event );
73 73 }
  74 + })
  75 + .bind( "focus.menu", function( event ) {
  76 + if ( self.options.disabled ) {
  77 + return;
  78 + }
  79 + self.focus( event, $( event.target ).children( ".ui-menu-item:first" ) );
  80 + })
  81 + .bind( "blur.menu", function( event ) {
  82 + if ( self.options.disabled ) {
  83 + return;
  84 + }
  85 + self.collapseAll( event );
74 86 });
75 87 this.refresh();
76 88

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.