diff options
| author | Stephen Blott | 2016-03-27 06:50:18 +0100 |
|---|---|---|
| committer | Stephen Blott | 2016-03-27 07:04:09 +0100 |
| commit | 11ade4ed2dae1b6f873d5c33e533f39a03838adf (patch) | |
| tree | 13789b934b82dfaad9fe561be1cb5e8930f3d862 | |
| parent | fa67b115ce1a20e64da5b8eaa67e2979fad8f89d (diff) | |
| download | vimium-11ade4ed2dae1b6f873d5c33e533f39a03838adf.tar.bz2 | |
Escape closes help dialog.
With the help dialog in an iframe, Escape no longer closes it if that
iframe loses the focus. This fixes that.
See point 2 of #2045.
This is not a perfect solution: it only works if the focus ends up in
the frame from which the help dialog was launched. However, that is the
the common case and, in particular, it is the case which arises on the
options page -- which is a particularly important use case.
| -rw-r--r-- | content_scripts/mode_key_handler.coffee | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/content_scripts/mode_key_handler.coffee b/content_scripts/mode_key_handler.coffee index bafdfd56..cc9ef10f 100644 --- a/content_scripts/mode_key_handler.coffee +++ b/content_scripts/mode_key_handler.coffee @@ -37,12 +37,17 @@ class KeyHandlerMode extends Mode onKeydown: (event) -> keyChar = KeyboardUtils.getKeyCharString event isEscape = KeyboardUtils.isEscape event - if isEscape and @countPrefix == 0 and @keyState.length == 1 - @continueBubbling - else if isEscape + if isEscape and (@countPrefix != 0 or @keyState.length != 1) @keydownEvents[event.keyCode] = true @reset() false # Suppress event. + # If the help dialog loses the focus, then Escape should hide it; see point 2 in #2045. + else if isEscape and HelpDialog?.showing + @keydownEvents[event.keyCode] = true + HelpDialog.hide() + @stopBubblingAndTrue + else if isEscape + @continueBubbling else if @isMappedKey keyChar @keydownEvents[event.keyCode] = true @handleKeyChar keyChar |
