VIMBindings: only allow if content view is focused

This commit is contained in:
James Magahern
2021-02-18 19:34:41 -08:00
parent 15aaa12797
commit 6cffd94c54

View File

@@ -29,7 +29,7 @@ extension BrowserViewController: VIMBindings
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
if action == #selector(VIMBindings.scrollDownPressed) || action == #selector(VIMBindings.scrollUpPressed) { if action == #selector(VIMBindings.scrollDownPressed) || action == #selector(VIMBindings.scrollUpPressed) {
return webView._currentContentView().isFocusingElement == false return webView._contentViewIsFirstResponder && webView._currentContentView().isFocusingElement == false
} }
return super.canPerformAction(action, withSender: sender) return super.canPerformAction(action, withSender: sender)