MenuList: FocusZone not wired for react-native-windows ('windows'), so menu items are Tab-only (no arrow-key roving focus)

未关闭 适合新手
#4,174 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

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

调研方向

从 packages/menu/src/MenuList/MenuList.tsx 开始,检查 shouldHaveFocusZone 如何为每个平台选择 focusZone 插槽。更新 Windows 路径,使 MenuList 使用与 win32 和 macos 相同的 FocusZone 行为,然后验证在 react-native-windows 上,Up、Down、Home 和 End 会在 MenuItems 之间移动焦点,同时现有平台保持不变。

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

描述

Willing to submit a PR to fix?
  • I am willing to submit a PR to fix
Requested priority

Normal

Products/applications affected
Summary

@fluentui-react-native/menu's MenuList only wraps its content in a FocusZone on
macos and win32, not on windows (react-native-windows / Fabric). On windows
the focusZone slot falls back to a plain View, so menu items are reachable only via
Tab — Up/Down/Home/End arrow-key roving focus does not work. This is an accessibility
gap (keyboard + screen-reader users expect arrow-key navigation within a menu).

Location

packages/menu/src/MenuList/MenuList.tsx:

const shouldHaveFocusZone = ['macos', 'win32'].includes(Platform.OS as string);
// ...
slots: { ..., focusZone: shouldHaveFocusZone ? FocusZone : View }

'windows' is not in the list.

Package version(s)

Package manager: yarn @fluentui-react-native/menu: 1.14.35 @fluentui-react-native/focus-zone: 0.21.11 (transitive, via @fluentui-react-native/menu) react-native-windows: 0.74.16 (New Architecture / Fabric, Platform.OS === 'windows') react-native: 0.74.5 react: 18.2.0

OS version(s)

No response

Platform
  • iOS
  • macOS
  • win32
  • windows
  • android
Xcode version

No response

Please provide a reproduction of the bug
Reproduction

Environment: a react-native-windows (New Architecture / Fabric) app,
Platform.OS === 'windows'.

Minimal component:

import { Menu, MenuTrigger, MenuList, MenuItem } from '@fluentui-react-native/menu';
import { Button } from '@fluentui-react-native/button';

export const Repro = () => (
  <Menu>
    <MenuTrigger>
      <Button>Open menu</Button>
    </MenuTrigger>
    <MenuList>
      <MenuItem>Item 1</MenuItem>
      <MenuItem>Item 2</MenuItem>
      <MenuItem>Item 3</MenuItem>
    </MenuList> </Menu>
);

Steps:

1. Run the app on  windows  (RNW / Fabric).
2. Open the menu and move keyboard focus onto the first  MenuItem .
3. Press the Down arrow (also try Up / Home / End).

Expected: focus moves between menu items (Down → Item 2 → Item 3; Up reverses;
Home/End jump to first/last) — the arrow-key roving focus you get on  win32 / macos .

Actual: arrow keys do nothing; items are reachable only by repeatedly pressing Tab.
On  windows ,  MenuList  renders its  focusZone  slot as a plain  View 
( shouldHaveFocusZone = ['macos','win32']  in  packages/menu/src/MenuList/MenuList.tsx ),
so there is no container-level FocusZone to intercept the arrow keys.

Cross-check: the same code on  win32  (or  macos ) navigates correctly with arrows,
confirming the difference is the missing  'windows'  FocusZone wiring, not the menu markup.


### Actual behavior

On  windows ,  focusZone  falls back to  View ; menu items are Tab-only, arrows do nothing.

### Expected behavior

On  windows  (RNW/Fabric),  MenuList  provides container-level arrow-key roving focus
(Up/Down/Home/End), consistent with  win32 / macos .
主要语言
TypeScript
星标
1.4k
派生
179
平均合并
16 小时 17 分钟
30 天内合并 PR
30

贡献指南

打开贡献指南

从这里开始

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

microsoft/fluentui-react-native 的其他 Issue

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

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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