briancherne / jquery-hoverIntent

hoverIntent jQuery Plug-in
https://briancherne.github.io/jquery-hoverIntent/
MIT License
826 stars 253 forks source link

Disabled button not firing "over" (in a very specific circumstance) #69

Closed oversword closed 5 years ago

oversword commented 6 years ago

This is a minor issue, experienced on Chrome 67, Linux.

When a button is given the attribute disabled="disabled" you can "sneak up" on it, if you approach it very slowly it will fail to trigger the "over" event, and hence fail to trigger the "out" event too. However, if you hover over the element quite quickly, it will trigger the correct events.

At first I though this was normal behaviour, since it seemed it would only trigger on "intent", but I cannot replicate this slow-fast difference in any other state (other than a disabled button), and normal behaviour appears to be that "over" should trigger immediately on any element.

Obviously this is something to do with the disabled attribute, but it doesn't seem like desired functionality to disable hoverIntent for this attribute, nor does that seem to be the case for the "quick" firing scenario. However, a simple fix may be to declare that disabled is disabled, and you can just use styling to make the button appear disabled with a class if you don't want such functionality.

Specific case:

hoverIntent v1.9.0 // 2017.09.01 // jQuery v1.7.0+ jQuery JavaScript Library v1.12.4 jQuery UI - v1.12.1 - 2018-05-30 Bootstrap v3.3.7

My fix: luckily, bootstrap's .btn.disabled has the desired behaviour/style without the hoverIntent bug

usmonster commented 6 years ago

Hi, and thanks for writing up the detailed report!

To help us investigate this, can you please provide a minimal JSFiddle (i.e. only including necessary markup, JS, and CSS) that clearly demonstrates the issue (e.g., step-by-step instructions, simple visual feedback on over/out)?

Also, can you please verify whether or not this issue also occurs when you use jQuery's own hover handler in place of hoverIntent?

Thanks!

usmonster commented 5 years ago

I'll close this now due to inactivity. Still, please feel free to comment with the requested information, and then I can reopen it. Thanks again for the report!