Search and Top Navigation
#8845 closed bug (worksforme)
Opened November 23, 2012 04:33AM UTC
Closed November 23, 2012 12:39PM UTC
Page redirection on click of autocomplete item now doesn't work in latest version
Reported by: | Zuallauz | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.10.0 |
Component: | ui.autocomplete | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hi,
Ok how my autocomplete code is supposed to work is: the user enters some search words, then when they type one of those words it brings up a menu of web pages on my site that the user can redirect to. When they click on the auto complete item with the mouse or select the item by using the arrow keys then pressing enter then it will redirect them to the page.
Now I had this working perfectly in jQueryUI 1.8.21 and since upgrading to jQueryUI 1.9.1 I can now only get it to redirect to the page when using the arrow and enter keys on the autocomplete item. Using the mouse to click on the autocomplete item no longer works and just redirects back to the same page for some reason.
Not sure what changed but it appears to be broken in this part of the code:
select: function( event, ui ) { // Redirect to the url $( "#searchTerms" ).val( ui.item.label ); window.location.href = ui.item.url; return false; }
Now jsFiddle doesn't have jQueryUI and JS Bin is refusing to run properly today and I can't make an account to save the code, so what I've done is stripped everything back to a very basic example and created a zip file for you. In the zip file are two folders. One is the old jQueryUI version which works, and in the other is the new jQueryUI version which doesn't work.
https://www.dropbox.com/sh/sotyg66wcp6wi4c/nIylsmLpxT/jumper.zip
To test simply type in 'create' into the text box, then on the items that show up, try selecting with the arrow keys and pressing enter which should redirect you to another url (which doesn't actually exist but nevermind). Then try again but this time click the item with the mouse and see if it redirects properly.
The main problem is the mouse click does not redirect properly in the new jQueryUI for some reason. Can you help me figure out what the problem is?
Thanks very much
Attachments (0)
Change History (1)
Changed November 23, 2012 12:39PM UTC by comment:1
resolution: | → worksforme |
---|---|
status: | new → closed |
There are at least 3 CDNs that host jQuery UI, surely you can create an example on jsFiddle.
There's no reason that changing
window.location
should fail inside autocomplete'sselect
callback, especially not based on mouse vs. keyboard. I can confirm that in a completely reduced test case (I created my own based your code block above) this is working fine. Please ask for help on the forums.