Fix VoiceOver focus staying in place after navigating

This commit is contained in:
Shadowfacts 2021-06-17 23:30:50 -04:00
parent 984ecc8879
commit fccce078b2
3 changed files with 8 additions and 0 deletions

View File

@ -128,11 +128,13 @@ class BrowserNavigationController: UIViewController {
private func onNavigate(_ operation: NavigationManager.Operation) {
let newVC: BrowserWebViewController
var postAccessibilityNotification = false
switch operation {
case .go:
backBrowserVCs.append(currentBrowserVC)
newVC = BrowserWebViewController(navigator: navigator, url: navigator.currentURL)
postAccessibilityNotification = true
case .reload:
currentBrowserVC.reload()
@ -163,6 +165,10 @@ class BrowserNavigationController: UIViewController {
self.toolbarOffset = 0
}
if postAccessibilityNotification {
// this moves focus to the nav bar, which isn't ideal, but it's better than nothing
UIAccessibility.post(notification: .screenChanged, argument: nil)
}
}
private let startEdgeNavigationSwipeDistance: CGFloat = 75

View File

@ -151,6 +151,7 @@ class BrowserWebViewController: UIViewController {
func reload() {
loaded = false
loadedFallback = false
document = nil
loadDocument()
}

View File

@ -39,6 +39,7 @@ class NavigationBarView: UIView {
textField = UITextField()
textField.text = navigator.displayURL
textField.borderStyle = .roundedRect
textField.textContentType = .URL
textField.keyboardType = .URL
textField.returnKeyType = .go
textField.autocapitalizationType = .none