Clicking on scrollbar in ac_results breaks .blur() behavior
Closed this issue · 5 comments
Steps to reproduce
Set up a situation where the results produced by autocomplete have a vertical scrollbar.
Click on the scroll bar
Click somewhere outside the autocomplete setup
The div showing the results should disappear, but it does not.
I've temporarily worked around the problem by adding this to my code:
$(document).click(function(e){
var t = $(e.target);
if (t.parents('.ac_results').length == 0 && !t.is('.ac_results') &&
t.parents('#input_wrapper').length == 0 && !t.is('#input_wrapper')) {
$(".ac_results").hide();
}
});
Hi, fgosfacdjtq. I finally got around to checking this out and after some reasearch I realize that this is a jQuery bug. The issue occurs when clicking scrollbars, where .mouseup()
doesn’t fire at all on tracks, thumbs and buttons. Weirdly enough, .mousedown()
does not fire on scrollbar corners.
These bugs appear in all browsers except FF. More information in this StackExchange question. I reported the jQuery bug in their bugtracker, here.
I’m leaving the issue open until the jQuery bug is addressed. Thanks for bringing this up!
Quick update:
As jitter has correctly stated in the above-mentioned jQuery bug report, this is a case of browsers simply not firing the events, and not a jQuery-specific problem. It happens with plain old Javascript.
Next step for me is to look into the functions that depend on these events firing properly and see if there is any way of circumventing this bug.
Thanks again!
I came up with a simple enough solution. Now, when you click on the scrollbar and hover outside of the results list, focus is brought back to the input element and the proper variables set to allow the results list to hide in the event of an out-of-input click.
This should serve as a less intrusive solution than binding a click event to the document root on every page you use the plugin, as your temporary fix does. Please let me know how this works for you. Just grab the latest version in the repository.
I hope to hear from you soon. Cheers!
Thanks for the fix. It works well in Chrome 9, IE8, and FF3.5
Thanks for the update!