From 776a3dbfdd01d508116735a8e29769328d1c0259 Mon Sep 17 00:00:00 2001 From: Joshua Ching Date: Thu, 1 Feb 2024 13:37:21 -0800 Subject: [PATCH] fix voiceover duplicates for labels --- .../AdaptiveCards/AdaptiveCards/ACRTextBlockRenderer.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/ios/AdaptiveCards/AdaptiveCards/AdaptiveCards/ACRTextBlockRenderer.mm b/source/ios/AdaptiveCards/AdaptiveCards/AdaptiveCards/ACRTextBlockRenderer.mm index 8246a6847..e45c70db1 100644 --- a/source/ios/AdaptiveCards/AdaptiveCards/AdaptiveCards/ACRTextBlockRenderer.mm +++ b/source/ios/AdaptiveCards/AdaptiveCards/AdaptiveCards/ACRTextBlockRenderer.mm @@ -115,7 +115,12 @@ - (UIView *)render:(UIView *)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; }