Open awall1 opened 7 years ago
Hi, thanks for the PR. Can you upload some screens about what changes with this feature?
@PGLongo funny thing is, there are no visual changes. Only someone using VoiceOver (a blind person) will be able to hear the difference. VoiceOver is an accessibility tool built into iOS that will read out loud what each element on a screen is.
Whenever the HUD is shown, VoiceOver will speak whatever is in the accessibilityLabel
.
Below are what I've set the accessibilityLabel to for each HUD type:
switch content {
case .success:
self.accessibilityLabel = "Success!"
case .error:
self.accessibilityLabel = "Error!"
case .image(_),
.rotatingImage(_):
self.accessibilityLabel = "Image"
case .label(let title):
guard let label = title else { break }
self.accessibilityLabel = label
case .labeledSuccess(let title, let subtitle),
.labeledError(let title, let subtitle),
.labeledProgress(let title, let subtitle),
.labeledImage(_, let title, let subtitle),
.labeledRotatingImage(_, let title, let subtitle):
guard title != nil || subtitle != nil else { break }
self.accessibilityLabel = (title ?? "") + "\n" + (subtitle ?? "")
default:
self.accessibilityLabel = "Please wait."
}
The labels aren't ideal in that they don't always present with perfect context (i.e. "Image" tells me nothing), but it's at least a start.
This is in reference to: #212
I've added some generic Accessibility Labels to the content view for each type. If there is a specific title or subtitle, it will speak that text instead.
Known issue: After HUD is dismissed, the VoiceOver will focus on the first UI element directly behind it (typically right in the center).