mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Selectmenu: unbind Menu document click event (fires unwanted focus event)
This commit is contained in:
parent
b356e1e4e1
commit
c0f9dd31e9
12
ui/jquery.ui.selectmenu.js
vendored
12
ui/jquery.ui.selectmenu.js
vendored
@ -154,6 +154,9 @@ $.widget( "ui.selectmenu", {
|
|||||||
// change menu styles?
|
// change menu styles?
|
||||||
this._setOption( "dropdown", this.options.dropdown );
|
this._setOption( "dropdown", this.options.dropdown );
|
||||||
|
|
||||||
|
// unbind Menu document event
|
||||||
|
$( document ).unbind( "click.menu" );
|
||||||
|
|
||||||
// document click closes menu
|
// document click closes menu
|
||||||
this._bind( document, {
|
this._bind( document, {
|
||||||
click: function( event ) {
|
click: function( event ) {
|
||||||
@ -204,15 +207,8 @@ $.widget( "ui.selectmenu", {
|
|||||||
|
|
||||||
// check if menu has items
|
// check if menu has items
|
||||||
if ( this.items ) {
|
if ( this.items ) {
|
||||||
var currentItem = this._getSelectedItem();
|
|
||||||
// needs to be fired after the document click event has closed all other Selectmenus
|
|
||||||
// otherwise the current item is not indicated
|
|
||||||
// TODO check if this should be handled by Menu
|
|
||||||
this._delay( function(){
|
|
||||||
this.menu.menu( "focus", event, currentItem );
|
|
||||||
}, 1);
|
|
||||||
|
|
||||||
if ( !this.options.dropdown ) {
|
if ( !this.options.dropdown ) {
|
||||||
|
var currentItem = this._getSelectedItem();
|
||||||
// center current item
|
// center current item
|
||||||
if ( this.menu.outerHeight() < this.menu.prop( "scrollHeight" ) ) {
|
if ( this.menu.outerHeight() < this.menu.prop( "scrollHeight" ) ) {
|
||||||
this.menuWrap.css( "left" , -10000 );
|
this.menuWrap.css( "left" , -10000 );
|
||||||
|
Loading…
Reference in New Issue
Block a user