A framework for building native applications using React
Fix action labels on iOS, fixes #53496 (#54286)
Summary:
This is my PR 2 out of 3 to improve accessibility on iOS. If you're reading this, please also have a look at https://github.com/facebook/react-native/pull/54131, this is a critical race condition bug that basically makes accessibility extremely hard to handle on large apps.
Fix for https://github.com/facebook/react-native/issues/53496: on the new architecture, any accessibility label is ignored and only the "name" is read by VoiceOver. We want to use name as an "action id", and label as the translatable value. While android has a id/label system for actions, iOS doesn't so my implementation, inspired by the old paper architecture, maps labels to name. Native iOS will only see the labels but the JS side will properly receive names when an action is executed. I believe this is the correct way of handling this. Another thing we could do is just deprecate "label" and expect name to be in the correct language, but I do not like that.
## Changelog:
[IOS][FIXED] - Accessibility actions labels are not read by VoiceOver
Pull Request resolved: https://github.com/facebook/react-native/pull/54286
Test Plan:
Open RN-Tester, go to Accessibility -> Accessibility Action Examples, enable VoiceOver and select "This view supports many actions". Now scroll up fast to select the actions.
On the current implementation you will hear VoiceOver say "copy", then "cut", then "paste". It now says "cut label", "copy label", "paste label".
As a reference, here's how this view is implemented:
```jsx
<View
accessible={true}
accessibilityActions={[
{name: 'cut', label: 'cut label'},
{name: 'copy', label: 'copy label'},
{name: 'paste', label: 'paste label'},
]}
onAccessibilityAction={event => {
switch (event.nativeEvent.actionName) {
case 'cut':
Alert.alert('Alert', 'cut action success');
break;
case 'copy':
Alert.alert('Alert', 'copy action success');
break;
case 'paste':
Alert.alert('Alert', 'paste action success');
break;
}
}}>
<RNTesterText>This view supports many actions.</RNTesterText>
</View>
```
Reviewed By: cipolleschi
Differential Revision: D87766483
Pulled By: javache
fbshipit-source-id: a979f0126efce4b87c6d823519d512229fb4118e M
Maxence Henneron committed
602a2d213a735e43c92edff3e2357085fa0d3af7
Parent: d0e9b9c
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com>
on 12/9/2025, 12:59:33 PM