aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content_scripts/mode_key_handler.coffee11
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