superfish icon indicating copy to clipboard operation
superfish copied to clipboard

delay should be applied to hoverIntent not superfish

Open mjau-mjau opened this issue 10 years ago • 3 comments

Just thought I'd remark that delay should be applied to the hoverIntent plugin (if enabled) instead of to superfish. Why? Because on "mouse-piloting errors", once the mouse is again over the menu element (within delay), it re-triggers hoverIntent which will not trigger "open" again until intent is determined ... this will often cause an animated menu to flash close/open while the mouse is back over the item.

To avoid this, one should be using the hoverIntent timeout setting instead, which prevents over/out handlers from firing when they shouldn't. timeout as quoted from hoverIntent docs:

A simple delay, in milliseconds, before the "out" function is called. If the user mouses back over the element before the timeout has expired the "out" function will not be called (nor will the "over" function be called). This is primarily to protect against sloppy/human mousing trajectories that temporarily (and unintentionally) take the user off of the target element... giving them time to return. Default timeout: 0

Personally, I added the hoverIntent timeout manually, and just kept superfish delay to 0:

// $menu.hoverIntent(over, out, targets);
// fixed timeout delay to work in hoverintent instead of superfish:
$menu.hoverIntent({
  over: over,
  out: out,
  selector: targets,
  timeout: 300
});

mjau-mjau avatar Aug 02 '14 16:08 mjau-mjau

Thanks for noticing this and explaining exactly what is going on. I wanted Superfish to have a built-in delay for those who don't use hoverIntent for whatever reason, but given that nowadays it is required for various touch devices to be supported maybe I should just make hoverIntent a firm requirement. Thanks for providing a workaround in the meantime.

joeldbirch avatar Aug 07 '14 08:08 joeldbirch

Facing this issue. Could you please give more details about this solution? Where should we add above mentioned code?

girish-khadse avatar Feb 25 '16 07:02 girish-khadse

I have created a branch named 'hoverintent' which has this patch in but I am not seeing any noticeable difference in behaviour. In which browsers are you seeing the "flash close/open" behaviour, and does this new branch behave any differently in it? Thanks.

joeldbirch avatar May 03 '16 02:05 joeldbirch