Escape inside a focused submenu closes the entire Dropdown instead of returning to its parent item
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 67/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- react, typescript
调研方向
Start with src/hooks/useAccessibility.ts and trace how Escape is handled when focus is inside a nested Menu submenu. Reproduce the reported sequence in Chrome: open the Dropdown, focus Submenu, open it with ArrowRight, then press Escape. Done means the submenu closes, focus returns to its parent menuitem, and the parent Dropdown stays open without calling onOpenChange(false).
由索引模型根据 Issue 内容生成。
描述
Reproduction
import Dropdown from '@rc-component/dropdown';
import Menu from '@rc-component/menu';
<Dropdown trigger={['click']} overlay={
<Menu items={[{ key: 'sub', label: 'Submenu', children: [
{ key: 'child', label: 'Child' },
] }]} />
}>
<button>Nested actions</button>
</Dropdown>
- Click the trigger.
- Press Tab to focus Submenu.
- Press ArrowRight to open the submenu and focus Child.
- Press Escape once.
Actual: both the submenu and parent Dropdown close, onOpenChange(false) runs, and focus goes to the Dropdown trigger.
Expected: close the submenu that contains focus and return focus to its parent menuitem; leave the parent Dropdown open. This follows the Escape behavior in the APG menu pattern.
Verification and scope
Reproduced with real Chrome key presses on macOS, using the source at PR #273 head b22af69306b82d60e64c6f513956564d019fe781 and again with only src/hooks/useAccessibility.ts restored from its base b4ea62f3293851934d64d9d92cbbd07d87a40dea. Both have this behavior, so this is an existing integration problem, not a regression introduced by #273. The single-level Escape focus fix in #273 works in the same native-browser comparison.
Dependencies: React/ReactDOM 19.3.1, menu 1.6.0, trigger 3.10.1, portal 2.2.1. Dependencies were installed in an isolated checkout from declared ranges (no upstream lockfile). An independent jsdom Dropdown/Menu integration test also observes the parent-close callback in both hook versions. No screen-reader conformance claim.
Checked open/closed submenu and Escape issue/PR searches here before filing. #38 concerns old menu-v6 layout; #272/#273 concern single-level Escape focus return. No duplicate source patch opened. AI-assisted reproduction and report; the described browser actions and tests were executed locally.
- 主要语言
- TypeScript
- 星标
- 181
- 派生
- 112
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
react-component/dropdown 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 55/100
react-component/dropdown#272 ·
-
难度 3/5 1-2 天 新手友好度 45/100
react-component/dropdown#245 ·
-
难度 3/5 1-2 天 新手友好度 35/100
react-component/dropdown#242 ·
-
难度 5/5 一周以上 新手友好度 15/100
react-component/dropdown#241 ·
-
难度 5/5 一周以上 新手友好度 20/100
react-component/dropdown#231 ·
查看 react-component/dropdown 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
oxidecomputer/skepsis#102 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
voidzero-dev/void#677 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
kunchenguid/gh-axi#247 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
lidge-jun/opencodex#8101 · 2 条评论 ·
维护者通常 1 天内回复