-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding VoiceOver Accessibility compatibility. #213
base: master
Are you sure you want to change the base?
Conversation
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. 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setAccessibilityProperties
shouldn't be an UIView extension. It's correct and useful only in Hud.swift
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).