Skip to content

Commit

Permalink
fix: role="searchbox" should assing "SearchField" trait on iOS (#39314)
Browse files Browse the repository at this point in the history
Summary:
Experimenting with Accessibility Inspector on iOS I've discovered that while when assigning `accessibilityRole="searchbox"` to a text input results in "Traits" reporting "Search Field" trait. However, when using ARIA-compatible `role="search"` such trait is not assigned, and text input will have an empty trait.

Afaiu this is incorrect as using `role="search"` and `accessibilityRole="searchbox"` should equivalent effect.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

IOS FIXED - `role="searchbox"` now assigns "Search Field" accessibility trait to a view

Pull Request resolved: #39314

Test Plan: No UI changes, it affects only accessibility.

Reviewed By: NickGerleman

Differential Revision: D49014039

Pulled By: dmytrorykun

fbshipit-source-id: 5fb194e67fbf2ac339d9a746e3ce6aaed2d32558
  • Loading branch information
mdjastrzebski authored and facebook-github-bot committed Sep 6, 2023
1 parent ef3e771 commit 2749fbc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-native/React/Views/RCTViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ @implementation RCTConvert (UIAccessibilityTraits)
@"scrollbar" : @(UIAccessibilityTraitNone),
@"scrollview" : @(UIAccessibilityTraitNone),
@"search" : @(UIAccessibilityTraitSearchField),
@"searchbox" : @(UIAccessibilityTraitNone),
@"searchbox" : @(UIAccessibilityTraitSearchField),
@"selected" : @(UIAccessibilityTraitSelected),
@"separator" : @(UIAccessibilityTraitNone),
@"slider" : @(UIAccessibilityTraitNone),
Expand Down

0 comments on commit 2749fbc

Please sign in to comment.