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) { private func onNavigate(_ operation: NavigationManager.Operation) {
let newVC: BrowserWebViewController let newVC: BrowserWebViewController
var postAccessibilityNotification = false
switch operation { switch operation {
case .go: case .go:
backBrowserVCs.append(currentBrowserVC) backBrowserVCs.append(currentBrowserVC)
newVC = BrowserWebViewController(navigator: navigator, url: navigator.currentURL) newVC = BrowserWebViewController(navigator: navigator, url: navigator.currentURL)
postAccessibilityNotification = true
case .reload: case .reload:
currentBrowserVC.reload() currentBrowserVC.reload()
@ -163,6 +165,10 @@ class BrowserNavigationController: UIViewController {
self.toolbarOffset = 0 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 private let startEdgeNavigationSwipeDistance: CGFloat = 75

View File

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

View File

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