Skip to content

Commit

Permalink
Include accessibilityValue prop values in accessibilityValue (#39184)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #39184

Previously, when `props.accessibilityValue` was enabled and other props were enabled, like `props.accessibilityRole`, that are used in the accessibilityValue for iOS, the value from `props.accessibilityValue` wasn't announced.

This is a problem for cases like radio button, which also needs to announce the placement of the radio button within a group, e.g. "[label], radio button, checked, 1 out of 3".

This diff fixes this problem by including the value from `props.acessibilityValue` within the method that builds the `accessibiityValue` for VoiceOver.

Reviewed By: cipolleschi

Differential Revision: D48534155

fbshipit-source-id: 176ba76ff772741a5cdc7d2a56c6cdfb92674477
  • Loading branch information
carmenvkrol authored and facebook-github-bot committed Aug 28, 2023
1 parent ef7ab56 commit 0c25f19
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,13 @@ - (NSString *)accessibilityValue
[valueComponents addObject:RCTLocalizedString("busy", "an element currently being updated or modified")];
}

// Using super.accessibilityValue:
// 1. to access the value that is set to accessibilityValue in updateProps
// 2. can't access from self.accessibilityElement because it resolves to self
if (super.accessibilityValue) {
[valueComponents addObject:super.accessibilityValue];
}

if (valueComponents.count > 0) {
return [valueComponents componentsJoinedByString:@", "];
}
Expand Down

0 comments on commit 0c25f19

Please sign in to comment.