From 3539ad89382c02bf2f89d890b86e49409059391f Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 27 Mar 2016 12:35:36 +0100 Subject: Finally fix help-dialog focus issue. In the previous commits, I omitted to actually check that the help dialog wasn't closing on the options page. I should be good now. --- content_scripts/ui_component.coffee | 2 +- pages/help_dialog.coffee | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/content_scripts/ui_component.coffee b/content_scripts/ui_component.coffee index ac0bea71..4c9b18e1 100644 --- a/content_scripts/ui_component.coffee +++ b/content_scripts/ui_component.coffee @@ -76,7 +76,7 @@ class UIComponent if event.target == window window.removeEventListener "focus", @onFocus @onFocus = null - @postMessage "hide" + @postMessage "frameFocused" @showing = true hide: (focusWindow = true)-> diff --git a/pages/help_dialog.coffee b/pages/help_dialog.coffee index f12b19a3..0e4a8973 100644 --- a/pages/help_dialog.coffee +++ b/pages/help_dialog.coffee @@ -27,19 +27,11 @@ HelpDialog = HelpDialog.toggleAdvancedCommands, false) document.documentElement.addEventListener "click", (event) => - # Normally, we hide the help dialog on "click". On the options page though, we do not. This allows the - # user to view the help page while typing command names into the key mappings input; see #2045. - @hide() unless @isVimiumOptionsPage() or @dialogElement.contains event.target + @hide() unless @dialogElement.contains event.target , false isReady: -> true - isVimiumOptionsPage: -> - try - window.top.isVimiumOptionsPage - catch - false - show: (html) -> for own placeholder, htmlString of html @dialogElement.querySelector("#help-dialog-#{placeholder}").innerHTML = htmlString @@ -86,7 +78,9 @@ HelpDialog = UIComponentServer.registerHandler (event) -> switch event.data.name ? event.data when "frameFocused" - HelpDialog.hide() unless event.data.focusFrameId == frameId + # We normally close when we lose the focus. However, we do not close on the options page. This allows + # users to view the help dialog while typing in the key-mappings input. + HelpDialog.hide() unless event.data.focusFrameId == frameId or try window.top.isVimiumOptionsPage when "hide" HelpDialog.hide() else -- cgit v1.2.3