From ef37f57d635edcc4a4861aff5db4eb3c0763a5e8 Mon Sep 17 00:00:00 2001 From: Kyle Hickinson Date: Thu, 24 Jun 2021 09:53:12 -0400 Subject: [PATCH] Fix #3838: Improve menu accessibility - Adds support for accessibility escape while VoiceOver is active - Increases the top inset so there is always space to tap to dismiss the menu --- .../Menu/Bookmarks/BookmarksViewController.swift | 5 +++++ .../Toolbars/BottomToolbar/Menu/MenuViewController.swift | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Client/Frontend/Browser/Toolbars/BottomToolbar/Menu/Bookmarks/BookmarksViewController.swift b/Client/Frontend/Browser/Toolbars/BottomToolbar/Menu/Bookmarks/BookmarksViewController.swift index c71c5458901..9782101f113 100644 --- a/Client/Frontend/Browser/Toolbars/BottomToolbar/Menu/Bookmarks/BookmarksViewController.swift +++ b/Client/Frontend/Browser/Toolbars/BottomToolbar/Menu/Bookmarks/BookmarksViewController.swift @@ -536,6 +536,11 @@ class BookmarksViewController: SiteTableViewController, ToolbarUrlActionsProtoco self.navigationController?.pushViewController(vc, animated: true) } } + + override func accessibilityPerformEscape() -> Bool { + dismiss(animated: true) + return true + } } extension BookmarksViewController: BookmarksV2FetchResultsDelegate { diff --git a/Client/Frontend/Browser/Toolbars/BottomToolbar/Menu/MenuViewController.swift b/Client/Frontend/Browser/Toolbars/BottomToolbar/Menu/MenuViewController.swift index 6d2df498b81..f394b1f6d71 100644 --- a/Client/Frontend/Browser/Toolbars/BottomToolbar/Menu/MenuViewController.swift +++ b/Client/Frontend/Browser/Toolbars/BottomToolbar/Menu/MenuViewController.swift @@ -160,6 +160,11 @@ class MenuViewController: UINavigationController, UIPopoverPresentationControlle private var isPresentingInnerMenu: Bool { presentedViewController is InnerMenuNavigationController } + + override func accessibilityPerformEscape() -> Bool { + dismiss(animated: true) + return true + } } extension MenuViewController: PanModalPresentable { @@ -198,10 +203,10 @@ extension MenuViewController: PanModalPresentable { return _scrollViewChild(in: topVC.view) } var longFormHeight: PanModalHeight { - .maxHeight + .maxHeightWithTopInset(32) } var shortFormHeight: PanModalHeight { - isPresentingInnerMenu ? .maxHeight : .contentHeight(initialHeight) + isPresentingInnerMenu ? .maxHeightWithTopInset(32) : .contentHeight(initialHeight) } var allowsExtendedPanScrolling: Bool { true