diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-08-04 13:26:42 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-08-04 13:26:42 -0400 |
commit | ed07f0a05656d2c66db453c8f6d664f69ec1a04d (patch) | |
tree | 2936caa668e43387b7845071d4dc221137f7cba3 | |
parent | 85b8816fa9480005aedb3354714abbc1ead06897 (diff) | |
download | jquery-ui-ed07f0a05656d2c66db453c8f6d664f69ec1a04d.tar.gz jquery-ui-ed07f0a05656d2c66db453c8f6d664f69ec1a04d.zip |
Autocomplete: Don't reset text field value on blur unless it will actually change the value. Fixes #5900 - Autocomplete: mousing over menu option replaces text box contents, moves caret.
-rw-r--r-- | ui/jquery.ui.autocomplete.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 75dfdc747..98130ab50 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -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 ); } } |