fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

[ContextualMenu] Cannot open submenu when hover if the first menu item has submenu

Open jieqiu0129 opened this issue 5 years ago • 4 comments

Environment Information

  • Package version(s): 7.168.2 and 8
  • Browser and OS versions: chrome, edge-chromium

Please provide a reproduction of the bug in a codepen:

https://codepen.io/jieqiu0129/pen/eYvjyVL

Actual behavior:

When open the context menu, then hover the parent menu item directly, the submenu cannot be shown. Only by clicking on the item or move out the mouse and re-hover, the submenu will be opened.

Expected behavior:

Should show submenu when hovering parent item.

jieqiu0129 avatar Jun 09 '21 04:06 jieqiu0129

@jieqiu0129 - Thanks for reaching out and submitting this issue with the codepen.

@ling1726 - Would you be able to confirm if this is a regression, or if this behavior is an issue?

gouttierre avatar Jul 12 '21 12:07 gouttierre

@jieqiu0129 This is a bug for ContextualMenu. As workarounds you can:

  • use the DefaultButton variant with menuProps which will work.
  • use shouldFocusOnMount={false} in your example to make it work. Here is a repro of this workaround here: https://codesandbox.io/s/interesting-https-wt869?file=/src/App.js, however you should managed focus appropriately for your a11y

From first investigation it seems that the difference between using ContextualMenu and DefaultButton with menu, is that when ContextualMenu is opened, the first menu item is focused, which stops mouse hover from opening the submenu. In the DefaultButton variant the entire menu is focused on open, and not the first menuitem.

@gouttierre please triage for someone in the v8 team to investigate this bug

ling1726 avatar Jul 12 '21 14:07 ling1726

@ling1726 Thanks for your investigation! The workaround work for me

jieqiu0129 avatar Jul 13 '21 02:07 jieqiu0129

@ling1726 by using shouldFocusOnMount={false} and having few ContextualMenus on a page, when one is open and you click to open another one, the former is remaining open..

il421 avatar Sep 21 '21 11:09 il421