jquery-autocomplete icon indicating copy to clipboard operation
jquery-autocomplete copied to clipboard

DIV closes on Scrollbar click

Open myrandor opened this issue 13 years ago • 6 comments
trafficstars

This is a "repost" from someone who submitted it on GoogleCode.

When the following css change is done to put a "scrollbar": .acResults { padding: 0px; border: 1px solid WindowFrame; background-color: Window; overflow-x: hidden; overflow-y: auto; max-height:250px; }

The div closes automatically when clicked on scroll bar in non-FF browsers.

I'm using the latest version as of today.

myrandor avatar Apr 06 '12 17:04 myrandor

Here an example of ui-autocomplete where the scroll works: http://jqueryui.com/demos/autocomplete/maxheight.html

myrandor avatar Apr 06 '12 17:04 myrandor

this should do the trick: /** * Finish on blur event * Use a timeout because instant blur gives race conditions */

    $elem.blur(function() {
        if (self.finishOnBlur_) {
            $('*').not('.'+this.options.resultsClass).click(function(){
                self.deactivate(true);
            });
            //self.finishTimeout_ = setTimeout(function() { self.deactivate(true); }, 200);
        }
    });

technixp avatar Nov 21 '12 22:11 technixp

But what if you blur because of an event that is not a click?

dyve avatar Nov 22 '12 07:11 dyve

@dyve, @techni7's solution worked for me..

Maybe it should be exposed to the public API as an option..

Anyway thanks!

adardesign avatar Dec 31 '12 21:12 adardesign

Unless I am missing something, it only blurs on a click event. I am quite sure there are other reasons for blurring (such as tabbing outside of the autocompleter). It might be so that all these other "blur reasons" are caught elsewhere, but it feels wrong enough to keep this outside of the main code for now.

I would welcome explanations / further research.

dyve avatar Jan 03 '13 06:01 dyve

I'm confused as to why this is not fixed yet. Any other autocomplete I've used works properly with a scrollbar (jQuery-UI, bassistance.de). The solution posted above doesn't work very well. It works, but clicking outside of the drop-down doesn't close it, and scrolling through the returned values using the cursor keys doesn't scroll when you get to the bottom. I also get "Cannot read property 'resultsClass' of undefined" when clicking back outside the drop-down.

ManOrMonster avatar Mar 25 '13 21:03 ManOrMonster