ActionMenu: add preventFocusOnClose
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 68/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- react, typescript
- 领域
- frontend
调研方向
首先阅读 ActionMenu.Overlay 的实现及其焦点管理测试。添加所请求的 preventFocusOnClose 行为,以便调用方可以跳过将焦点恢复到菜单锚点,同时默认保持当前行为。当该 prop 有测试覆盖,且 Markdown 编辑器用例能够在菜单关闭后管理焦点和选区时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Feature request
👋🏾 Hi team! We have a markdown editor use case where it would be helpful to handle focus ourselves when an ActionMenu closes.
Motivation
Repro of our bug (selecting a Preview card option makes the cursor jump back to the start of the doc) is in this PR: https://github.com/github/github-ui/pull/36135
The default behaviour is sensible for most menus, however in our case, selecting an item converts the menu anchor from an inline link into a block Preview node. ActionMenu then closes and restores focus to the original anchor, which has been replaced. Because the Preview is not an editable text position, the browser falls back to the nearest editable text, sometimes at the start of the document. We've worked around it with a double requestAnimationFrame, but ideally we'd like ActionMenu.Overlay to support a preventFocusOnClose prop which we'd use to skip restoring focus to the anchor, then return focus and restore the editor selection ourselves.
Thank you!
- 主要语言
- TypeScript
- 星标
- 3.9k
- 派生
- 691
- 平均合并
- 3 天 6 小时
- 30 天内合并 PR
- 54
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
primer/react 的其他 Issue
-
FormControl renders duplicate non-choice inputs when layout="horizontal"可能已有人在做 @namangoyal176-10 于 2 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
PageHeader.Title does not seem to accept id prop可能已有人在做 @minwookshin 于 8 天前认领。 未关闭component: PageHeader react staff
难度 2/5 1-3 小时 新手友好度 72/100
primer/react#8474 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
The padding prop seems to have no effect with PageLayout.Sidebar可能已有人在做 @minwookshin 于 8 天前认领。 未关闭component: PageLayout react staff
难度 2/5 1-3 小时 新手友好度 68/100
primer/react#8470 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug component: Spinner react
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
waiting for author response
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
lukilabs/beautiful-mermaid#160 ·
-
难度 2/5 1-3 小时 新手友好度 66/100
rescript-lang/rescript-lang.org#1420 ·
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
chthollyphile/folia-major#520 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
databuddy-analytics/Databuddy#1106 ·
维护者通常 1 天内回复