diff options
author | kborchers <kris.borchers@gmail.com> | 2012-05-18 15:55:10 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-05-18 15:55:10 -0400 |
commit | 098dd1404b7b6025a5735495a91ca2b964c5cb3e (patch) | |
tree | d39144a55dea70c9282413030577a451e3bc2a8b /ui | |
parent | 0adc6f5e17593d6bd42e6c0586eb85000883dec3 (diff) | |
download | jquery-ui-098dd1404b7b6025a5735495a91ca2b964c5cb3e.tar.gz jquery-ui-098dd1404b7b6025a5735495a91ca2b964c5cb3e.zip |
Autocomplete: Added check to prevent accidental focus of menu-item on page load in Firefox. Fixed #7024 - Autocomplete menu options are activated even if mouse is not moved.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.autocomplete.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 8ab48ba03..685bbca11 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -57,6 +57,7 @@ $.widget( "ui.autocomplete", { this.isMultiLine = this.element.is( "textarea,[contenteditable]" ); this.valueMethod = this.element[ this.element.is( "input,textarea" ) ? "val" : "text" ]; + this.isNewMenu = true; this.element .addClass( "ui-autocomplete-input" ) @@ -220,6 +221,20 @@ $.widget( "ui.autocomplete", { } }, menufocus: function( event, ui ) { + // #7024 - Prevent accidental activation of menu items in Firefox + if ( this.isNewMenu ) { + this.isNewMenu = false; + if ( event.originalEvent && /^mouse/.test(event.originalEvent.type) ) { + this.menu.blur(); + + this.document.one( "mousemove", function() { + $( event.target ).trigger( event.originalEvent ); + }); + + return; + } + } + // back compat for _renderItem using item.autocomplete, via #7810 // TODO remove the fallback, see #8156 var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ); @@ -422,6 +437,7 @@ $.widget( "ui.autocomplete", { if ( this.menu.element.is(":visible") ) { this.menu.element.hide(); this.menu.blur(); + this.isNewMenu = true; this._trigger( "close", event ); } }, |