Skip to content
Permalink
Browse files

Menu: Ignores mouse clicks on menu bar items and adds support for clo…

…sing with touch
  • Loading branch information...
pjackson28 committed Nov 10, 2013
1 parent a105d10 commit 673d98503d73b85b356745b7f2690ae420026b9d
Showing with 15 additions and 4 deletions.
  1. +15 −4 src/plugins/menu/menu.js
@@ -258,14 +258,25 @@ onHoverFocus = function( event ) {
},

/*
* Causes clicks on panel menu items to open submenus
* Causes clicks on panel menu items to open and close submenus (except for mouse)
* @method onPanelClick
* @param {jQuery event} event The current event
*/
onPanelClick = function( event ) {
if ( $( "#wb-sm" ).find( ".nav-close" ).is( ":visible" ) ) {
var which = event.which,
$this;

if ( which === 1 ) {
event.preventDefault();
} else if ( !which ) {
event.preventDefault();
$( this ).trigger( "focusin" );
$this = $( this );
if ( $( "#wb-sm" ).find( ".nav-close" ).is( ":visible" ) ) {
$this.trigger( "focusin" );
} else if ( !which ) {
event.preventDefault();
onReset( $this, true );
}
}
};

@@ -334,7 +345,7 @@ $document.on( "click vclick", selector + " .item", onPanelClick );
/*
* Menu Keyboard bindings
*/
$document.on( "mouseover focusin", selector + " .item", onHoverFocus );
$document.on( "mouseover focusin", selector + " .item[aria-haspopup]", onHoverFocus );

$document.on( "keydown", selector + " .item", function( event ) {
var elm = event.target,

0 comments on commit 673d985

Please sign in to comment.
You can’t perform that action at this time.