Skip to content
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

VoiceOver Accessibility #212

Closed
awall1 opened this issue Nov 14, 2017 · 1 comment
Closed

VoiceOver Accessibility #212

awall1 opened this issue Nov 14, 2017 · 1 comment

Comments

@awall1
Copy link

awall1 commented Nov 14, 2017

Currently, it doesn't seem that there is any compatibility for VoiceOver.
I've played with adding these lines into PKHUD, but that's not enough (or always the right) context for each PKHUD type.

init() {
    ...
    self.container.accessibilityLabel = "In progress, please wait."
    UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, self.container)
}

I've also tried setting the label for each Content View type in HUD, but then the UIAccessibilityPostNotification(...) doesn't work when trying to set the focus on the container.

fileprivate extension UIView {
    fileprivate func setAccessibilityProperties(for content: HUDContentType) {
        self.accessibilityLabel = "Please wait."
        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 = "In progress, please wait."
        }
    }
}

Suggestions?

@awall1
Copy link
Author

awall1 commented Nov 16, 2017

I created the PR: #213 to address this.

@awall1 awall1 closed this as completed Nov 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant