Skip to content

accessibilityState={{ selected }} is crashing the app #16060

@mgarv-amzn

Description

@mgarv-amzn

Problem Description

The app is crashing for any component using accessibilityState={{ selected }}. While dev testing some changes, we noticed the app crashes when Narrator is active and when we navigate to these elements using Tab.

Looks like this was introduced by RNW (https://github.com/microsoft/react-native-windows/pull/14019)  shipped in 0.81.3+,  I believe. Narrator queries SelectionItemPattern and hits a null pointer in RNW's get_SelectionContainer().

We managed to avoid the crash by setting the state to checked, but it provides wrong accessibility information.

Steps To Reproduce

  1. Make sure you have an interactive element with accessibilityState={{ selected }}
  2. Enable the screen reader Narrator
  3. Navigate to this component
  4. App should crash

Expected Results

Narrator should read the element with the correct selected state and the app shouldn't crash.

CLI version

20.0.0

Environment

System:
  OS: Windows 11 10.0.26100
  CPU: (16) x64 Intel(R) Core(TM) Ultra 7 265H
  Memory: 31.73 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.12
    wanted: 0.81.12
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

info React Native v0.85.2 is now available (your project is running on v0.81.6).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.85.2
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.81.6&to=0.85.2
info For more info, check out "https://reactnative.dev/docs/upgrading?os=windows".

Community Modules

"@gorhom/portal": "^1.0.14",
"@hbannro/rn-documents-picker-windows": "^10.1.1",
"@react-native-async-storage/async-storage": "^2.1.2",
"@tanstack/react-query": "^5.90.2",
"clang-format": "^1.8.0",
"lodash": "^4.17.21",
"react": "19.1.4",
"react-native": "0.81.6",
"react-native-svg": "^15.12.1",
"react-native-svg-transformer": "^1.5.0",
"react-native-windows": "0.81.12"

Target React Native Architecture

New Architecture (WinAppSDK) Only

Target Platform Version

None

Visual Studio Version

Visual Studio 2022

Build Configuration

Debug

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Triage 🔍New issue that needs to be reviewed by the issue management team (label applied by bot)bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions