diff options
Diffstat (limited to 'vimiumFrontend.js')
| -rw-r--r-- | vimiumFrontend.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/vimiumFrontend.js b/vimiumFrontend.js index 6a3fd698..a175f0eb 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -510,6 +510,8 @@ function onKeydown(event) { } else if (isEscape(event)) { keyPort.postMessage({keyChar:"<ESC>", frameId:frameId}); + handleEscapeForNormalMode(); + suppressEvent(event); } } @@ -980,6 +982,13 @@ function hideHelpDialog(clickEvent) { clickEvent.preventDefault(); } +function handleEscapeForNormalMode() { + if (document.activeElement !== document.body) + document.activeElement.blur(); + else if (window.top !== window.self) + chrome.extension.sendRequest({ handler: "focusTopFrame" }); +} + /* * A heads-up-display (HUD) for showing Vimium page operations. * Note: you cannot interact with the HUD until document.body is available. |
