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

Window not gaining focus on app start

未关闭
#16,176 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
react-native

调研方向

Issue 未指明源文件、测试或入口点。首先在一个新的 React Native Windows 应用中复现启动行为,其中第一个组件不可获得焦点,并包含一个可获得焦点的控件;当启动后无需点击即可立即使用键盘导航,并且第一个可获得焦点的元素或带有 autoFocus 的元素获得焦点时,即视为完成。

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

描述

bug Invalid Triage Needs: Triage :mag:
Problem Description

When the React Native Windows app launches, the main window does not automatically receive keyboard focus. This means:

  • Users cannot immediately interact with the app using keyboard navigation (Tab, Enter, arrow keys, etc.)

  • Accessibility tools (screen readers) don't announce the app content on launch

  • Users must first click inside the window before keyboard input is recognized

Steps To Reproduce
  • Create a new React Native Windows app
  • Add a first component not focusable
  • Add a focusable element (e.g., a Pressable or TextInput)
  • Launch the app
  • Without clicking, try pressing Tab or interacting via keyboard
  • Observe that nothing happens until the window is clicked
Expected Results

Expected behavior:

When the app window opens and becomes the foreground window, it should automatically have keyboard focus so that:

  • Tab navigation works immediately
  • The first focusable element (or a designated autoFocus element) receives focus

Actual behavior:

The window appears in the foreground but keyboard focus is not set. The user must click inside the window before any keyboard/focus-based interaction works. This is particularly problematic for:

  • Accessibility compliance (WCAG 2.1 requires operable keyboard interfaces)
  • Users who rely on keyboard-only navigation
CLI version

20.0.0

Environment
System:
  OS: Windows 11 10.0.26100
  CPU: (16) x64 Intel(R) Core(TM) Ultra 7 265H
  Memory: 30.96 GB / 63.43 GB
Binaries:
  Node:
    version: 22.22.0
    path: C:\Program Files\nodejs\node.exe
  Yarn:
    version: 1.22.22
    path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
  npm:
    version: 10.9.4
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    AllowAllTrustedApps: Enabled
    Versions:
      - 10.0.19041.0
      - 10.0.22621.0
      - 10.0.26100.0
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.14.37216.2 (Visual Studio Community 2022)
    - 16.11.37206.5 (Visual Studio Professional 2019)
Languages:
  Java: Not Found
  Ruby:
    version: 3.0.2
    path: C:\tools\ruby30\bin\ruby.exe
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.1.4
    wanted: 19.1.4
  react-native:
    installed: 0.81.6
    wanted: 0.81.6
  react-native-windows:
    installed: 0.81.15
    wanted: 0.81.15
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Community Modules

No response

Target React Native Architecture

None

Target Platform Version

None

Visual Studio Version

None

Build Configuration

None

Snack, code example, screenshot, or link to a repository

No response

主要语言
C++
星标
17.4k
派生
1.2k
平均合并
2 天 23 小时
30 天内合并 PR
16

环境准备

从这里开始

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

microsoft/react-native-windows 的其他 Issue

查看 microsoft/react-native-windows 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

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