Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

ActionMenu: add preventFocusOnClose

未关闭 适合新手
#8,488 1 条评论 1 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@tay1orjones 已经在做这个了。

开始于 2026年10月6日。

  • #8513 来自 @tay1orjones —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
react, typescript
领域
frontend

调研方向

首先阅读 ActionMenu.Overlay 的实现及其焦点管理测试。添加所请求的 preventFocusOnClose 行为,以便调用方可以跳过将焦点恢复到菜单锚点,同时默认保持当前行为。当该 prop 有测试覆盖,且 Markdown 编辑器用例能够在菜单关闭后管理焦点和选区时,即为完成。

由索引模型根据 Issue 内容生成。

描述

component: ActionMenu

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

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

primer/react 的其他 Issue

查看 primer/react 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。