mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Menu: Close menus immediately on selection or click outside
Fixes #15034 Closes gh-1807
This commit is contained in:
parent
b3c0a7f71d
commit
0d25a36eec
@ -670,7 +670,9 @@ QUnit.test( "handle keyboard navigation and mouse click on menu with dividers an
|
|||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
|
||||||
assert.equal( logOutput(), "keydown,3,4,7", "Keydown focus skips divider and group label" );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
|
||||||
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
|
||||||
|
assert.equal( logOutput(), "keydown,1,2,3,4,7", "Keydown focus skips divider and group label" );
|
||||||
ready();
|
ready();
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -162,7 +162,7 @@ return $.widget( "ui.menu", {
|
|||||||
this._on( this.document, {
|
this._on( this.document, {
|
||||||
click: function( event ) {
|
click: function( event ) {
|
||||||
if ( this._closeOnDocumentClick( event ) ) {
|
if ( this._closeOnDocumentClick( event ) ) {
|
||||||
this.collapseAll( event );
|
this.collapseAll( event, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the mouseHandled flag
|
// Reset the mouseHandled flag
|
||||||
@ -502,7 +502,7 @@ return $.widget( "ui.menu", {
|
|||||||
this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" );
|
this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" );
|
||||||
|
|
||||||
this.activeMenu = currentMenu;
|
this.activeMenu = currentMenu;
|
||||||
}, this.delay );
|
}, all ? 0 : this.delay );
|
||||||
},
|
},
|
||||||
|
|
||||||
// With no arguments, closes the currently active menu - if nothing is active
|
// With no arguments, closes the currently active menu - if nothing is active
|
||||||
|
Loading…
Reference in New Issue
Block a user