Search and Top Navigation
#7423 closed bug (fixed)
Opened May 26, 2011 06:07PM UTC
Closed November 23, 2011 06:41PM UTC
Last modified December 20, 2011 04:42PM UTC
Tab out of autocomplete with remote source can leave menu showing.
Reported by: | sp | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.0 |
Component: | ui.autocomplete | Version: | 1.8.13 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
This is reproducible using the remote data source example at: http://jqueryui.com/demos/autocomplete/remote.html
Steps to reproduce:
1) Go to example above.
2) Enter 'ro' into field.
3) At the moment you see the spinner, press the tab key
Result:
If you time it just right, you will see the menu pop up, but the focus will be somewhere else. Depending on the browser, it could be on the result field, or on the url in the browser window. This can lead to very strange behavior. If you have two autocompletes side-by-side, and you tab to the second one at the right moment, both will be showing their menus at the same time, with focus on the second field. The slower the data source, the more likely this will happen.
Expected:
A check to make sure the field still has focus before showing the menu.
Reproduced in Safari and FireFox on Mac.
Attachments (0)
Change History (10)
Changed May 26, 2011 06:36PM UTC by comment:1
Changed May 27, 2011 12:46PM UTC by comment:2
status: | new → open |
---|
Changed May 27, 2011 03:52PM UTC by comment:3
New fix at https://github.com/spekary/jquery-ui/commit/f010015eb9b2c0aaa23f00098c78956db1f0b414. Previous fix broke the external search function.
Changed May 27, 2011 06:52PM UTC by comment:4
OK, this is giving me fits. Is there a proper place to have a forum to discuss this solution?
The problem is that you have the possibility of two asynchronous events returning at different times, each effecting the other. As I have been thinking about it, I actually think my first post is the correct solution, because I also think that the correct thing to do is force the field to have the focus if .autocomplete( "search" ) is called. If it doesn't have the focus, then you can still get the possibility of two menus showing up simultaneously, since the menu will not get a blur event if it doesn't have the focus. To prevent the two menu problem, the user of autocomplete must either make sure he focuses the field before the search, or make sure to manually blur the menu when some other event happens.
A test case is difficult to post, because it relies on a slow json call, and jsFiddle and jsbin don't seem to play nice with json easily.
Changed May 27, 2011 07:34PM UTC by comment:5
Replying to [comment:4 sp]:
OK, this is giving me fits. Is there a proper place to have a forum to discuss this solution?
Yup. http://forum.jquery.com/developing-jquery-ui and/or #jqueryui-dev on freenode (irc)
Changed May 28, 2011 07:57PM UTC by comment:6
Conversation started at http://forum.jquery.com/topic/trying-to-fix-autocomplete-double-menu-problem. Do we fix just this problem, or the related problem caused by an external search? Both can cause two menus to appear. See the test code there.
Changed May 31, 2011 10:47PM UTC by comment:7
3rd time
Changeset: d4257dcde7e49639edbf2a4fd7eb8c6c0254cd97
Changed October 18, 2011 08:24PM UTC by comment:8
Checked in unit test for fix.
Changed November 23, 2011 06:41PM UTC by comment:9
resolution: | → fixed |
---|---|
status: | open → closed |
Autocomplete: Making sure we do not show search menu after a blur. Fixed #7423 - Tab out of autocomplete with remote source can leave menu showing.
Changeset: 2445e20a856192179590c0d08e5d73479df1e52d
Changed December 20, 2011 04:42PM UTC by comment:10
#7936 is a duplicate of this ticket.
Fix at https://github.com/spekary/jquery-ui/commit/67338bfb94b577c5ce568aa535f39c5077413653