Skip to content

Commit

Permalink
#Alert accessibility fix
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 711922810
  • Loading branch information
Nobody authored and material-automation committed Jan 4, 2025
1 parent 24a0ffb commit 0ac0dfe
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/Dialogs/src/MDCAlertController.m
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,15 @@ - (void)messageDidChange {
}
self.preferredContentSize =
[self.alertView calculatePreferredContentSizeForBounds:CGRectInfinite.size];

self.alertView.messageTextView.accessibilityLabel =
self.messageAccessibilityLabel ?: self.message;

if ([self shouldUseAttributedStringForMessageA11Y]) {
self.alertView.messageTextView.accessibilityLabel = self.attributedMessage.string;
} else {
self.alertView.messageTextView.accessibilityValue = @"";
}
}

- (void)setMessageAccessibilityLabel:(nullable NSString *)messageAccessibilityLabel {
Expand Down

0 comments on commit 0ac0dfe

Please sign in to comment.