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

Add modal escape for VoiceOver #49

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions ContextMenu/ClippedContainerViewController.swift
Expand Up @@ -13,7 +13,7 @@ class ClippedContainerViewController: UIViewController {
let viewController: UIViewController

private let options: ContextMenu.Options
private let containedViewController: UINavigationController
private let containedViewController: ModalNavigationViewController

override var preferredStatusBarStyle: UIStatusBarStyle {
return viewController.preferredStatusBarStyle
Expand All @@ -22,7 +22,7 @@ class ClippedContainerViewController: UIViewController {
init(options: ContextMenu.Options, viewController: UIViewController) {
self.viewController = viewController
self.options = options
self.containedViewController = UINavigationController(rootViewController: viewController)
self.containedViewController = ModalNavigationViewController(rootViewController: viewController)
super.init(nibName: nil, bundle: nil)
self.containedViewController.delegate = self
}
Expand Down
20 changes: 20 additions & 0 deletions ModalNavigationViewController.swift
@@ -0,0 +1,20 @@
//
// ModalNavigationViewController.swift
// ContextMenu
//
// Created by Bas Broek on 01/04/2019.
//

import UIKit

class ModalNavigationViewController: UINavigationController {
override var accessibilityViewIsModal: Bool {
get { return true }
set {}
}

override func accessibilityPerformEscape() -> Bool {
dismiss(animated: UIAccessibility.isReduceMotionEnabled == false)
return true
}
}