customized accessibility for cell

This commit is contained in:
Kevin G Christiano 2020-04-28 08:33:23 -04:00
parent 9b570c1a9a
commit 8e47e4ceb3
3 changed files with 11 additions and 9 deletions

View File

@ -127,7 +127,7 @@ import UIKit
func updateAccessibilityLabel() {
if let state = MVMCoreUIUtility.hardcodedString(withKey: isSelected ? "radio_selected_state" : "radio_not_selected_state") {
accessibilityLabel = String(format: MVMCoreUIUtility.hardcodedString(withKey: "radio_desc_state") ?? "%@%@", "", state)
accessibilityLabel = state
}
}

View File

@ -77,13 +77,13 @@ import UIKit
}
public override func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
radioButton.tapAction()
radioButton.tapAction()
}
func updateAccessibilityLabel() {
var message = "Radio Button, "
if let radioButtonLabel = radioButton.accessibilityLabel {
message += radioButtonLabel + ", "
}
@ -100,10 +100,10 @@ import UIKit
message += headlineLabel + ", "
}
if let bodyLabel = eyebrowHeadlineBodyLink.eyebrow.text {
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
message += bodyLabel
}
accessibilityLabel = message
}
}

View File

@ -301,11 +301,13 @@
[weakSelf.viewToLayout layoutIfNeeded];
};
//accessibility - added to make only top alert label and close button accessible. Posted notification when top alert is displayed
weakSelf.accessibilityElements = @[weakSelf.buttonView];
weakSelf.shortView.isAccessibilityElement = NO;
weakSelf.buttonView.label.accessibilityLabel = [NSString stringWithFormat:@"%@ - %@", [MVMCoreUIUtility hardcodedStringWithKey:@"top_alert_notification"],weakSelf.buttonView.label.accessibilityLabel];
void(^completion)(void) = ^(void) {
//accessibility - added to make only top alert label and close button accessible. Posted notification when top alert is displayed
weakSelf.accessibilityElements = @[weakSelf.buttonView];
weakSelf.shortView.isAccessibilityElement = NO;
weakSelf.buttonView.label.accessibilityLabel = [NSString stringWithFormat:@"%@ - %@", [MVMCoreUIUtility hardcodedStringWithKey:@"top_alert_notification"],weakSelf.buttonView.label.accessibilityLabel];
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, weakSelf.buttonView.label);
[operation markAsFinished];
};