aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/vimium_frontend.coffee
diff options
context:
space:
mode:
authormrmr19932017-04-20 17:34:46 +0100
committermrmr19932017-04-20 17:34:46 +0100
commitdf72a1be0213d211645f39f1ec6aeeba4d8e7896 (patch)
treeb0d27897f01faf8149a470213f80a1c1fe08bffd /content_scripts/vimium_frontend.coffee
parente3cce413029dd5efa718a48a057d0bcf77d31fb9 (diff)
downloadvimium-df72a1be0213d211645f39f1ec6aeeba4d8e7896.tar.bz2
Blur the focused iframe when restoring window focus
This works around FF issue 554039, which prevents window.top.focus() from working.
Diffstat (limited to 'content_scripts/vimium_frontend.coffee')
-rw-r--r--content_scripts/vimium_frontend.coffee3
1 files changed, 3 insertions, 0 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index cdb23352..e84346e1 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -315,6 +315,9 @@ focusThisFrame = (request) ->
chrome.runtime.sendMessage handler: "nextFrame"
return
window.focus()
+ # On Firefox, window.focus doesn't always draw focus back from a child frame (bug 554039).
+ # We blur the active element if it is an iframe, which gives the window back focus as intended.
+ document.activeElement.blur() if document.activeElement.tagName.toLowerCase() == "iframe"
flashFrame() if request.highlight
extend window,