It would be nice to add a delay to hover/un-hover events. It should be possible with CSS3. Here is an example: http://jsfiddle.net/aEgV3/ (via http://stackoverflow.com/questions/8566090/delay-hover-in-css3)
1. Tiny hover delay on second / third dropdown level (none on first).
2. Un-hover delay.
| Comment | File | Size | Author |
|---|---|---|---|
| #50 | admin_menu.mp4 | 778.18 KB | chi |
| #47 | admin_toolbar-update-delay-2504449-47.patch | 306 bytes | rwam |
| #35 | admin_toolbar-unhover_delay-2504449-35.patch | 10 KB | robin.ingelbrecht |
| #13 | admin_toolbar-unhover_delay-2504449-13.patch | 18.77 KB | robin.ingelbrecht |
| #12 | admin_toolbar-unhover_delay-2504449-12.patch | 18.8 KB | robin.ingelbrecht |
Comments
Comment #1
cweagans-1. I don't want to wait for the menus to show up. If this is implemented, please please please please please make it a configurable option.
Comment #2
eme commentedI do agree that we do not really want to wait for the menu to show, but having a un-hover delay is a very interesting idea.
Comment #3
leksat commentedSome argument for the hover-delay:
1) You just switched to a browser tab, and moving mouse cursor down to the page elements, the admin menu expanded overlapping your target.
Here "+ Add" is my target: https://www.drupal.org/files/issues/2504449-hover-delay-3-1_0.gif
2) You are hovering menu item (of an already expanded menu), you are moving cursor to the sub-item, and accidentally hovering (for an instant) another menu item. As a result, target sub-menu is collapsed.
Here "Development > Configuration management" is my target: https://www.drupal.org/files/issues/2504449-hover-delay-3-2_0.gif
So, I would make the hover-delay, but make it short.
Comment #4
eme commentedRight, a hover delay but only for the second dropdown level then, not the first one.
Comment #5
cweagans#1 is valid, but personally, I'd rather the menu pop up right when I want it instead of having a delay and just have to deal with that problem.
#2 is unfortunately a side effect of hover menus like this. You can't move your mouse right to the target, and that's generally accepted by everyone who has to interact with a menu like this. it's been an "issue" in admin_menu for years.
Like I said, if it's implemented, just make it a configurable option and everyone is happy.
Comment #6
eme commentedAre you annoyed with current admin menu on D7 ? Cause it not, it seems that there is indeed a tiny delay (at lease on un-hover).
Comment #7
chegor commentedYes, admin menu on D7 has delay on un-hover and and it helps a lot.
Comment #8
chi commentedIt might be worth to consider adopting hoverintent effect. I use it with admin menu and really like it.
#220100: Add support to detect hover intent (no dependencies added)
Comment #9
mstrelan commentedHuge +1 for hoverIntent.
Comment #10
robin.ingelbrecht commentedI'm planning on writing a patch which integrates hoverIntent with this module. Should I add the JS file in this module or would you guys prefer to add in in the /libraries directory?
Comment #11
eme commentedWell, it depends if you rely on an external library but I doubt it is necessary. Then a JS file seems good to me !
Comment #12
robin.ingelbrecht commentedFollowing patch integrates hoverIntent (https://github.com/briancherne/jquery-hoverIntent) with Admin toolbar. I made the hole thing configurable so that people who don't want to use this, can disable it.
Also added an update hook for people who already have the module installed. This update hook will set hoverIntent enabled to "FALSE".
Comment #13
robin.ingelbrecht commentedPatch still had a console.log() in it :(. Here's new one
Comment #14
eme commentedIsn't it a bit of overload ? Setting a little hover by default may be enough, isn't it ? Don't sure people will wish to define their own delay...
Comment #15
robin.ingelbrecht commentedOne of the comments in this issue:
...
Comment #16
chi commentedThe point of configurable option was to make happy those who don't like to wait for menu showing up. Hover intent offers a different approach which will not annoy people. See how admin menu works. There is no delay on opening new items at all.
The patch #12 (#13 is not applicable) does not make it work the same way
Comment #17
robin.ingelbrecht commentedSo you would just apply hover intent for everyone without the option to configure?
Comment #18
robin.ingelbrecht commentedAnd in addition. Should I include hover intent in this module? Or should it be in /libraries?
Comment #19
eme commentedWell yes I would say the simplest, the less code, the best... And to my mind a tiny JS should be just packaged into the module unless you rely on an external JS library which is not the case, isn't it ?
Comment #20
robin.ingelbrecht commentedI'm using a little JS snippet from https://github.com/briancherne/jquery-hoverIntent. That's why I'm not sure if I should ad it in the module...
Comment #21
eme commentedWell then we should indeed but it annoys me as I would love to keep it plug and play...
Comment #22
robin.ingelbrecht commentedI agree, it should be plug and play, but this plugin does exactly what everyone wants... Maybe we can just use the JS code in this module and adjust it to our needs? This way we can keep in the module as opposed to including it as a library. Do you have a better solution?
Comment #23
eme commentedNo indeed, if it does the work, we cloud fork it and package it into admin toolbar.
Comment #24
robin.ingelbrecht commentedOk so let's recapitulate. Create new patch with:
Do we agree on this approach?
Comment #25
eme commentedYes we do !
Comment #26
chi commentedThere is some copyright information in that plugin. Can we redistribute it under GPL license?
Comment #27
eme commentedUnfortunately not...
Comment #28
robin.ingelbrecht commentedSo this means we cannot copy the library and add in in the module?
Comment #29
eme commentedWell, apparently it is MIT licence
So we could include this even if keeping the file with the header and package it is indeed not a good Drupal practice...
Comment #30
robin.ingelbrecht commentedI agree that including libraries in your module is not good practice, but this means we can't keep it plug and play? Any suggestions?
The current patch in #13 includes the "library" (imo code snippet) into the module
Comment #31
mstrelan commentedYou could take a look at how Superfish or Nice Menus are including hoverIntent.
Comment #32
romainj commentedThe Superfish module requires you to install the HoverIntent library. I think that we do not want to do that for Admin Toolbar module. It really should stay plug and play.
Comment #33
eme commentedI think that we could use and package anyway your tiny js, keep the header and fork it (and explain it / link to this issue).
Comment #34
robin.ingelbrecht commentedOk. I'll post a new patch next week.
Comment #35
robin.ingelbrecht commentedI found a little time. This is the new patch without all the options.
I have set the "hover out" delay to 500ms. Maybe you guys should check if the current settings of the script are ok, I can still change the "hover out" delay or the sensitivity when the "hover in" event is called.
This patch keeps the module plug and play btw :)
Comment #36
robin.ingelbrecht commentedAnyone had time to review this patch?
Comment #37
eme commentedHello ! Patch seems good to me. I'll take some more time to run some more test and commit. If anyone else can also review, that would be great !
Comment #38
eme commentedJust tested out. Seems still all right for me. I would just say that a delay of 250 is large enough and makes the menu more reactive.
Comment #39
robin.ingelbrecht commentedShould I change the patch for the delay? Or will you just change it after applying the patch?
Comment #40
eme commentedNo, I will directly, don't worry.
Comment #42
eme commentedCommited to dev ! Thanks !
Comment #43
eme commentedComment #44
robin.ingelbrecht commentedEme, you are aware that for some reason a test failed?
Comment #45
eme commentedWell this is strange. I do not see why it would be related to this patch. I've posted another issue.
Comment #47
rwam commentedHi @eme, you mentioned a delay of 250ms, but on the commit and the current release it's 500ms. 500ms is really annoying and the usability is worse than before. Can we change this please? I've tested 250ms and it feels much more better. Please find attached a quick patch.
Ciao
Ralf
Comment #49
eme commentedIndeed. That's a mistake. Dev version is up-to-date with 250.
Comment #50
chi commentedIn attached file a record on how true hover intent should work. Unfortunately current implementation of this in Admin toolbar requires your to hover on desired menu item to open up. That is kind of annoying for some users.
Comment #51
eme commentedWe know it : it has been discussed here : #2908747: Add a config to disable the hoverintent functionality. We need a patch actually to implement.
Comment #52
chi commented@eme the point is that what currently Admin toolbar implements is not hoverintent at all. It is just hover without intent. If it was implemented as true hoverintent people would not ask for a way to disable it.