Skip to content

fix(menu): enable FocusZone in MenuList on react-native-windows - #4367

Open
udit (UditDewan) wants to merge 1 commit into
microsoft:mainfrom
UditDewan:fix/menulist-windows-focuszone
Open

udit (UditDewan) wants to merge 1 commit into
microsoft:mainfrom
UditDewan:fix/menulist-windows-focuszone

Conversation

@UditDewan

Copy link
Copy Markdown

Platforms Impacted

  • iOS
  • macOS
  • win32 (Office)
  • windows
  • android

Description of changes

Fixes #4174.

MenuList only rendered its focusZone slot as a FocusZone on macos and win32. On react-native-windows the slot fell back to a plain View, so there was no container-level roving focus and menu items were reachable only with Tab.

@fluentui-react-native/native-core now ships a Fabric FocusZone for windows (#4354) that handles focusZoneDirection, navigateAtEnd, tabKeyNavigation, and Home/End keys, so this enables it for windows as well:

  • packages/components/Menu/src/MenuList/MenuList.tsx: add 'windows' to shouldHaveFocusZone. The existing props passed to the focus zone (focusZoneDirection: 'vertical', enableFocusRing: false, tabKeyNavigation: 'None') now apply on windows too. Circular navigation and focus-on-container behavior are unchanged (still win32-only / macOS-only respectively).
  • MenuList.types.ts: update the slot comment.
  • Added a patch changeset for @fluentui-react-native/menu.

Verification

  • yarn build, yarn lint and yarn test for @fluentui-react-native/menu (all platforms' Jest suites pass), yarn format:check.
Before After
On windows, Up/Down/Home/End do nothing inside an open menu; items reachable only via Tab Arrow keys move between menu items vertically, Home/End jump to first/last, matching win32/macOS

Pull request checklist

This PR has considered (when applicable):

  • Automated Tests
  • Documentation and examples
  • Keyboard Accessibility
  • Voiceover
  • Internationalization and Right-to-left Layouts

MenuList only used FocusZone on macOS and win32, so on windows the
focusZone slot fell back to a plain View and menu items could only be
reached with Tab. Now that native-core ships a Fabric FocusZone for
windows, enable it there too so Up/Down/Home/End navigation works.

Fixes microsoft#4174
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant