Skip to content

Commit

Permalink
Autocomplete: Don't reset text field value on blur unless it will act…
Browse files Browse the repository at this point in the history
…ually change the value. Fixes #5900 - Autocomplete: mousing over menu option replaces text box contents, moves caret.
  • Loading branch information
scottgonzalez committed Aug 4, 2010
1 parent 85b8816 commit ed07f0a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ui/jquery.ui.autocomplete.js
Expand Up @@ -153,7 +153,10 @@ $.widget( "ui.autocomplete", {
self.selectedItem = item;
},
blur: function( event, ui ) {
if ( self.menu.element.is(":visible") ) {
// don't set the value of the text field if it's already correct
// this prevents moving the cursor unnecessarily
if ( self.menu.element.is(":visible") &&
( self.element.val() !== self.term ) ) {
self.element.val( self.term );
}
}
Expand Down

0 comments on commit ed07f0a

Please sign in to comment.