Skip to content

useMenuItem relies on stale React state #4083

@rurikoaraki

Description

@rurikoaraki

Willing to submit a PR to fix?

  • I am willing to submit a PR to fix

Requested priority

None

Products/applications affected

The behavior of FURN's menu item to not show focus visuals on mouse hover to work around the platform's focus limitations relies on stale React state.

On hover, it calls setEnableFocusRing(false) in onHoverIn, then .focus() via useHoverFocusEffect. The .focus() triggers onFocus, which checks !pressable.state.focused — but this value is stale (React hasn't flushed the hover state yet), so it incorrectly evaluates to true and calls setEnableFocusRing(true), overwriting the false from onHoverIn.

Package version(s)

@fluentui-react-native/menu: *

OS version(s)

No response

Platform

  • iOS
  • macOS
  • win32
  • windows
  • android

Xcode version

No response

Please provide a reproduction of the bug

Hover on a menu item

Actual behavior

No response

Expected behavior

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions