aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content_scripts/ui_component.coffee6
-rw-r--r--pages/help_dialog.coffee11
-rw-r--r--pages/vomnibar.coffee3
3 files changed, 12 insertions, 8 deletions
diff --git a/content_scripts/ui_component.coffee b/content_scripts/ui_component.coffee
index d381cb0f..ac0bea71 100644
--- a/content_scripts/ui_component.coffee
+++ b/content_scripts/ui_component.coffee
@@ -48,11 +48,9 @@ class UIComponent
@iframeElement.contentWindow.postMessage vimiumSecret, chrome.runtime.getURL(""), [ port2 ]
setIframePort port1
- # If any other frame in the current tab receives the focus, then we hide the UI component.
- # NOTE(smblott) This is correct for the vomnibar, but might be incorrect (and need to be revisited) for
- # other UI components.
chrome.runtime.onMessage.addListener (request) =>
- @postMessage "hide" if @showing and request.name == "frameFocused" and request.focusFrameId != frameId
+ if @showing and request.name == "frameFocused" and request.focusFrameId != frameId
+ @postMessage name: "frameFocused", focusFrameId: request.focusFrameId
false # Free up the sendResponse handler.
# Posts a message (if one is provided), then calls continuation (if provided). The continuation is only
diff --git a/pages/help_dialog.coffee b/pages/help_dialog.coffee
index 997ea915..f12b19a3 100644
--- a/pages/help_dialog.coffee
+++ b/pages/help_dialog.coffee
@@ -84,9 +84,14 @@ HelpDialog =
HelpDialog.dialogElement.classList[addOrRemove] "showAdvanced"
UIComponentServer.registerHandler (event) ->
- return if event.data == "hide"
- HelpDialog.init()
- HelpDialog.show event.data
+ switch event.data.name ? event.data
+ when "frameFocused"
+ HelpDialog.hide() unless event.data.focusFrameId == frameId
+ when "hide"
+ HelpDialog.hide()
+ else
+ HelpDialog.init()
+ HelpDialog.show event.data
root = exports ? window
root.HelpDialog = HelpDialog
diff --git a/pages/vomnibar.coffee b/pages/vomnibar.coffee
index 67fca64c..0332b12f 100644
--- a/pages/vomnibar.coffee
+++ b/pages/vomnibar.coffee
@@ -330,7 +330,8 @@ class BackgroundCompleter
chrome.runtime.sendMessage handler: "selectSpecificTab", id: tabId
UIComponentServer.registerHandler (event) ->
- switch event.data
+ switch event.data.name ? event.data
+ when "frameFocused" then Vomnibar.hide()
when "hide" then Vomnibar.hide()
when "hidden" then Vomnibar.onHidden()
else Vomnibar.activate event.data