briancherne / jquery-hoverIntent

hoverIntent jQuery Plug-in

Home Page:https://briancherne.github.io/jquery-hoverIntent/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

oversword opened this issue · comments

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

  • Using hoverintent() on the parent of a button
  • In the "closed" state, only the button is displaying
  • On "over" it opens, the button is hidden, and a menu appears
  • When in the "disabled" state the button is given a disabled attribute, and the "over" and "out" calls will return empty (or log their presence before return, for debugging)
  • On click, a disabled menu will re-enable and open
  • I noticed the menu would not then close on "out" (if not hovered on aggressively beforehand)
  • Logging the "over" and "out" I notice they were not even triggering in the scenario described
  • By elimination I found it would work in every case except when the disabled attribute was present

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

commented

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!

commented

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!