Skip to content

Commit

Permalink
[Snackbar] Fix dismissalAccessibilityAffordance not performing action…
Browse files Browse the repository at this point in the history
… on double tap.

PiperOrigin-RevId: 627385462
  • Loading branch information
Nobody authored and material-automation committed Apr 23, 2024
1 parent 02cd637 commit b3d1365
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion components/Snackbar/src/MDCSnackbarMessageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@

NS_ASSUME_NONNULL_BEGIN

@interface AccessibilityAffordanceButton : UIButton
@end

@implementation AccessibilityAffordanceButton

- (BOOL)accessibilityActivate {
[self sendActionsForControlEvents:UIControlEventTouchUpInside];
return YES;
}

@end

NSString *const MDCSnackbarMessageTitleAutomationIdentifier =
@"MDCSnackbarMessageTitleAutomationIdentifier";

Expand Down Expand Up @@ -373,7 +385,7 @@ - (instancetype)initWithMessage:(nullable MDCSnackbarMessage *)message
NSString *dismissalAccessibilityHint = NSLocalizedStringFromTableInBundle(
dismissalAccessibilityHintKey, kMaterialSnackbarStringsTableName, [[self class] bundle],
@"Dismissal accessibility hint for Snackbar");
_dismissalAccessibilityAffordance = [[UIButton alloc] init];
_dismissalAccessibilityAffordance = [[AccessibilityAffordanceButton alloc] init];
_dismissalAccessibilityAffordance.isAccessibilityElement = YES;
_dismissalAccessibilityAffordance.accessibilityLabel = dismissalAccessibilityLabel;
_dismissalAccessibilityAffordance.accessibilityHint = dismissalAccessibilityHint;
Expand Down

0 comments on commit b3d1365

Please sign in to comment.