ant-design / ant-design

An enterprise-class UI design language and React UI library
https://ant.design
MIT License
91.93k stars 48.98k forks source link

Menu - Submenu remains visible even after closing the parent menu #43267

Open SpaNb4 opened 1 year ago

SpaNb4 commented 1 year ago

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. Click on the "Click me" button to open the dropdown menu
  2. Click on the "Submenu" item
  3. Press the Esc key to close the parent menu

What is expected?

Submenu is closed

What is actually happening?

Submenu remains visible

Environment Info
antd 5.6.3
React 18.2.0
System Pop!_OS 22.04 LTS
Browser Version 114.0.5735.198
MadCcc commented 1 year ago

Should focus submenu when opened.

heiyu4585 commented 1 year ago

结论: Menu 自己维护的 active,这个有点难改的


  1. subMenu子菜单hover的时候触发一次 onAcitve,当前的aciveKey 就是 当前的hover子菜单 1-2
  2. 键盘事件->useAccessibility -> 会触发到offsetObj.offset < 0 触发一次关闭父级菜单的操作 triggerAccessibilityOpen]
tomislavdimitrov2003 commented 1 year ago

Issues is still present. Will there be a fix for it soon?

yoyo837 commented 9 months ago

https://github.com/react-component/menu/pull/671 Does this fix?

SpaNb4 commented 9 months ago

react-component/menu#671 Does this fix?

No, I can still reproduce the issue with rc-menu 9.12.3 installed: https://codesandbox.io/p/sandbox/antd-reproduction-template-forked-4rzmn8

yoyo837 commented 9 months ago

It looks like the issue is related to triggerSubMenuAction="click".

noxxxxxxxx commented 4 months ago

Still exist in the latest version image codesandbox