diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.js b/packages/react-native/Libraries/Components/TextInput/TextInput.js index 46c1d6c61a37..f9708f9cc953 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.js @@ -618,6 +618,9 @@ function InternalTextInput(props: TextInputProps): React.Node { // so omitting onBlur and onFocus pressability handlers here. const {onBlur, onFocus, ...eventHandlers} = usePressability(config); + const _accessibilityLabel = + props?.['aria-label'] ?? props?.accessibilityLabel; + let _accessibilityState; if ( accessibilityState != null || @@ -681,6 +684,7 @@ function InternalTextInput(props: TextInputProps): React.Node { {...otherProps} {...eventHandlers} acceptDragAndDropTypes={props.experimental_acceptDragAndDropTypes} + accessibilityLabel={_accessibilityLabel} accessibilityState={_accessibilityState} accessible={accessible} submitBehavior={submitBehavior} @@ -744,8 +748,9 @@ function InternalTextInput(props: TextInputProps): React.Node { {...otherProps} {...colorProps} {...eventHandlers} - accessibilityState={_accessibilityState} + accessibilityLabel={_accessibilityLabel} accessibilityLabelledBy={_accessibilityLabelledBy} + accessibilityState={_accessibilityState} accessible={accessible} acceptDragAndDropTypes={props.experimental_acceptDragAndDropTypes} autoCapitalize={autoCapitalize} diff --git a/packages/react-native/Libraries/Components/TextInput/__tests__/TextInput-test.js b/packages/react-native/Libraries/Components/TextInput/__tests__/TextInput-test.js index bf63d6957215..a33757e1e15a 100644 --- a/packages/react-native/Libraries/Components/TextInput/__tests__/TextInput-test.js +++ b/packages/react-native/Libraries/Components/TextInput/__tests__/TextInput-test.js @@ -432,6 +432,7 @@ jest.unmock('../TextInput'); expect(instance.toJSON()).toMatchInlineSnapshot(` = [ return ; }, }, + { + title: 'Accessibility', + render: function (): React.Node { + return ( + + accessibilityLabel prop + + aria-label prop + + + ); + }, + }, ]; module.exports = ({ diff --git a/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js b/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js index 1d628ade1f9d..1fea412d93c6 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js @@ -1036,6 +1036,21 @@ const textInputExamples: Array = [ ); }, }, + { + title: 'Accessibility', + render: function (): React.Node { + return ( + + + + + + + + + ); + }, + }, ]; module.exports = ({