From 52ce015c04b22ae8c519fcd5b420788f8825c800 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 12 Mar 2016 12:53:03 +0000 Subject: Global link hints; fix focus issue for options page. Here's the issue (and we may have to address this ouside of this PR). If we put the HUD in the top frame, then the top frame grabs the focus when the HUD is displayed. If we open link hints with the help dialog open, then the help dialog loses the focus, and we can't `Esc` out of it. --- content_scripts/link_hints.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index e695e869..36ab1c97 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -71,7 +71,7 @@ HintCoordinator = postKeyState: (request) -> @linkHintsMode.postKeyState request activateActiveHintMarker: -> @linkHintsMode.activateLink @linkHintsMode.markerMatcher.activeHintMarker - setMode: ({modeIndex}) -> @linkHintsMode.setOpenLinkMode availableModes[modeIndex], true + setMode: ({modeIndex}) -> @linkHintsMode.setOpenLinkMode availableModes[modeIndex], false getLocalHintMarker: (hint) -> if hint.frameId == frameId then @localHints[hint.localIndex] else null exit: -> @@ -140,7 +140,7 @@ class LinkHintsModeBase (event?.type == "keydown" and event.keyCode in [ keyCodes.backspace, keyCodes.deleteKey ]) HintCoordinator.sendMessage "exitFailure" - @setOpenLinkMode mode, true + @setOpenLinkMode mode, false # Note(philc): Append these markers as top level children instead of as child nodes to the link itself, # because some clickable elements cannot contain children, e.g. submit buttons. @@ -150,9 +150,9 @@ class LinkHintsModeBase @hideMarker marker for marker in hintMarkers when marker.hint.frameId != frameId @postKeyState = @postKeyState.bind this, hintMarkers - setOpenLinkMode: (@mode, doNotPropagate = false) -> - @hintMode.setIndicator @mode.indicator if DomUtils.isTopFrame() - unless doNotPropagate + setOpenLinkMode: (@mode, shouldPropagtetoOtherFrames = true) -> + @hintMode.setIndicator @mode.indicator if windowIsFocused() + if shouldPropagtetoOtherFrames HintCoordinator.sendMessage "setMode", modeIndex: availableModes.indexOf @mode # -- cgit v1.2.3