Skip to content

Commit

Permalink
Fix mozilla-mobile#6233 - Keyboard not dimissed when opening the libr…
Browse files Browse the repository at this point in the history
…ary panels from the home screen
  • Loading branch information
KrystynaKruchkovska committed Mar 17, 2020
1 parent 3bdee63 commit 7be3833
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Client/Frontend/Browser/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ class BrowserViewController: UIViewController {
NotificationCenter.default.addObserver(self, selector: #selector(appDidEnterBackgroundNotification), name: UIApplication.didEnterBackgroundNotification, object: nil)
KeyboardHelper.defaultHelper.addDelegate(self)

let tapGesture: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
view.addGestureRecognizer(tapGesture)

webViewContainerBackdrop = UIView()
webViewContainerBackdrop.backgroundColor = UIColor.Photon.Grey50
webViewContainerBackdrop.alpha = 0
Expand Down Expand Up @@ -545,6 +548,10 @@ class BrowserViewController: UIViewController {
clipboardBarDisplayHandler?.checkIfShouldDisplayBar()
}

@objc func dismissKeyboard() {
view.endEditing(true)
}

fileprivate func crashedLastLaunch() -> Bool {
return Sentry.crashedLastLaunch
}
Expand Down Expand Up @@ -1649,6 +1656,7 @@ extension BrowserViewController: LibraryPanelDelegate {
extension BrowserViewController: HomePanelDelegate {
func homePanelDidRequestToOpenLibrary(panel: LibraryPanelType) {
showLibrary(panel: panel)
view.endEditing(true)
}

func homePanel(didSelectURL url: URL, visitType: VisitType) {
Expand Down

0 comments on commit 7be3833

Please sign in to comment.