Skip to content

Commit 03c5b08

Browse files
Merge pull request philc#1609 from smblott-github/fix-grab-back-focus-after-web-navigation
Fix grab back focus after web navigation
2 parents fe8e089 + f1e46d8 commit 03c5b08

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

background_scripts/main.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ root.isEnabledForUrl = isEnabledForUrl = (request, sender) ->
100100
}
101101

102102
onURLChange = (details) ->
103-
chrome.tabs.sendMessage details.tabId, name: "checkEnabledAfterURLChange"
103+
chrome.tabs.sendMessage details.tabId, extend details, name: "checkEnabledAfterURLChange"
104104

105105
# Re-check whether Vimium is enabled for a frame when the url changes without a reload.
106106
chrome.webNavigation.onHistoryStateUpdated.addListener onURLChange # history.pushState.

content_scripts/vimium_frontend.coffee

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,11 @@ checkIfEnabledForUrl = (frameIsFocused = windowIsFocused()) ->
611611

612612
# When we're informed by the background page that a URL in this tab has changed, we check if we have the
613613
# correct enabled state (but only if this frame has the focus).
614-
checkEnabledAfterURLChange = ->
615-
checkIfEnabledForUrl() if windowIsFocused()
614+
checkEnabledAfterURLChange = (request) ->
615+
if windowIsFocused()
616+
checkIfEnabledForUrl()
617+
# We also grab back the focus. See #1588.
618+
new GrabBackFocus() if request.transitionType in [ "link", "form_submit" ]
616619

617620
# Exported to window, but only for DOM tests.
618621
window.refreshCompletionKeys = (response) ->

0 commit comments

Comments
 (0)