accessible-menu icon indicating copy to clipboard operation
accessible-menu copied to clipboard

Hover effect on does not feel consistent

Open hansinke opened this issue 10 months ago • 2 comments

When hover is set to on or dynamic it works fine when you skip from one item to another item when they have a submenu: one submenu closes and the other one opens. But when you move form an item with a submenu to an item without a submenu the submenu only closes after a click. Also you expect the submenu to close when you go to the main area or go a header item outside the navigation (for example the logo). An example: codepen ) An opportunity for that kind of behaviour should be fine. I did add some script separate in hansinke.nl. (hover = dynamic). When the mouse moves to the logo, main section or another menuitem it closes the submenu (and set the aria-expanded to false).

When hover is off then a mouseclick to open or close is always needed and that feels more predictable and maybe that is the best for all cases.

Edit by maintainer: Removed an extra "[" preventing the codepen link from working.

hansinke avatar Apr 03 '24 01:04 hansinke

Having a mouse click to open/close the menus for hover "on" would make it essentially identical to dynamic hover (especially since you indeed found a bug with dynamic hover, which I'll address shortly), so changing the way that works isn't something I'm willing to do. If I'm being entirely honest, hover "on" is an option purely because we have some clients who want it- I really don't like opening an menu as soon as you hover over it. It can be super confusing for people, but I digress. Hover "on" will remain the same.

Now, it's a different story for dynamic hover. It's based off of the ARIA APG's Navigation Menubar, and you have revealed an inconsistency between us and the APG (thank you).

It looks like we'll need to make sure dynamic hover follows the following guidelines:

  • When no submenus are open, hovering does nothing.
  • When a submenu is open, hovering will open other submenus (following the rules of the type of menu for if it needs to close siblings or not).
  • When a menu item that is not a submenu is hovered over, it will close all submenus on the same level as it.
  • When mouse focus leaves the menu entirely, all opened submenus will remain open until the user clicks or interacts with another part of the page, causing all submenus to close.

This all being said, if you foresee another kind of hover that would be beneficial, we can always add a 4th type.

NickDJM avatar Apr 03 '24 14:04 NickDJM

I agree that hovering can be very confusing, but indeed some people do like it. Your suggestion for the dynamic hover is a good one.

Op wo 3 apr 2024 om 16:34 schreef Nick Milton @.***>:

Having a mouse click to open/close the menus for hover "on" would make it essentially identical to dynamic hover (especially since you indeed found a bug with dynamic hover, which I'll address shortly), so changing the way that works isn't something I'm willing to do. If I'm being entirely honest, hover "on" is an option purely because we have some clients who want it- I really don't like opening an menu as soon as you hover over it. It can be super confusing for people, but I digress. Hover "on" will remain the same.

Now, it's a different story for dynamic hover. It's based off of the ARIA APG's Navigation Menubar https://www.w3.org/WAI/ARIA/apg/patterns/menubar/examples/menubar-navigation/, and you have revealed an inconsistency between us and the APG (thank you).

It looks like we'll need to make sure dynamic hover follows the following guidelines:

  • When no submenus are open, hovering does nothing.
  • When a submenu is open, hovering will open other submenus (following the rules of the type of menu for if it needs to close siblings or not).
  • When a menu item that is not a submenu is hovered over, it will close all submenus on the same level as it.
  • When mouse focus leaves the menu entirely, all opened submenus will remain open until the user clicks or interacts with another part of the page, causing all submenus to close.

This all being said, if you foresee another kind of hover that would be beneficial, we can always add a 4th type.

— Reply to this email directly, view it on GitHub https://github.com/NickDJM/accessible-menu/issues/303#issuecomment-2034799258, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZZ2ZV3TFX5Y3H3I6BMLMDY3QHOTAVCNFSM6AAAAABFULT4DSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZUG44TSMRVHA . You are receiving this because you authored the thread.Message ID: @.***>

-- Groet Han

hansinke avatar Apr 03 '24 14:04 hansinke

Requires #299 and #315

NickDJM avatar Jun 24 '24 15:06 NickDJM

Unless something major comes up, this is the last issue holding back a 4.1.0 release. I have spent a bit of time on this now (see #318) and hopefully I'll have some time in the next week or so to finish it off.

NickDJM avatar Jun 24 '24 20:06 NickDJM

v4.1.0 is out and includes this. Closing.

NickDJM avatar Jun 25 '24 16:06 NickDJM