Skip to content

Commit

Permalink
fix voiceover duplicates for labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Ching authored and Joshua Ching committed Feb 1, 2024
1 parent ab44e1c commit 776a3db
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ - (UIView *)render:(UIView<ACRIContentHoldingView> *)viewGroup

lab.textContainer.lineBreakMode = NSLineBreakByTruncatingTail;
lab.attributedText = content;
// if accessibility label is the same as accessibility value, clear accessibility value
// this prevents the same content from being repeated twice in voiceover
lab.accessibilityLabel = content.string;
if (lab.accessibilityValue != nil && [lab.accessibilityValue isEqualToString:lab.accessibilityLabel]) {
lab.accessibilityValue = @"";
}
if ([content.string stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceCharacterSet].length == 0) {
lab.accessibilityElementsHidden = YES;
}
Expand Down

0 comments on commit 776a3db

Please sign in to comment.