Fix keyboard not being dismissed in some circumstances

This commit is contained in:
Shadowfacts 2020-12-20 15:25:52 -05:00
parent 040a799b7b
commit e27ac15635
2 changed files with 13 additions and 0 deletions

View File

@ -34,6 +34,10 @@ class BrowserNavigationController: UIViewController {
if (oldValue <= 0.5 && toolbarOffset > 0.5) || (oldValue > 0.5 && toolbarOffset <= 0.5) {
setNeedsStatusBarAppearanceUpdate()
if navBarView.textField.isFirstResponder {
navBarView.textField.resignFirstResponder()
}
}
}
}
@ -205,6 +209,10 @@ class BrowserNavigationController: UIViewController {
if position == .end {
self.navigator.goBack()
}
if self.navBarView.textField.isFirstResponder {
self.navBarView.textField.resignFirstResponder()
}
}
gestureState = .backwards(animator)
} else if location.x > view.bounds.width - startEdgeNavigationSwipeDistance && velocity.x < 0 && navigator.forwardStack.count > 0 {
@ -236,6 +244,10 @@ class BrowserNavigationController: UIViewController {
if position == .end {
self.navigator.goForward()
}
if self.navBarView.textField.isFirstResponder {
self.navBarView.textField.resignFirstResponder()
}
}
gestureState = .forwards(animator)
}

View File

@ -81,6 +81,7 @@ class BrowserWebViewController: UIViewController {
webView.scrollView.delegate = scrollViewDelegate
// this doesn't default to .default :S
webView.scrollView.indicatorStyle = .default
webView.scrollView.keyboardDismissMode = .interactive
webView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(webView)
NSLayoutConstraint.activate([