aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--background_page.html7
-rw-r--r--vimiumFrontend.js9
2 files changed, 16 insertions, 0 deletions
diff --git a/background_page.html b/background_page.html
index d72f3fc9..706aeb1f 100644
--- a/background_page.html
+++ b/background_page.html
@@ -38,6 +38,7 @@
openOptionsPageInNewTab: openOptionsPageInNewTab,
registerFrame: registerFrame,
frameFocused: handleFrameFocused,
+ focusTopFrame: focusTopFrame,
upgradeNotificationClosed: upgradeNotificationClosed,
updateScrollPosition: handleUpdateScrollPosition,
copyToClipboard: copyToClipboard,
@@ -627,6 +628,7 @@
if (request.is_top) {
focusedFrame = request.frameId;
+ framesForTab[sender.tab.id].topId = request.frameId;
framesForTab[sender.tab.id].total = request.total;
}
@@ -654,6 +656,11 @@
chrome.tabs.sendRequest(tabId, { name: "focusFrame", frameId: mainFrameId, highlight: false });
}
+ function focusTopFrame(request, sender) {
+ var tabId = sender.tab.id;
+ chrome.tabs.sendRequest(tabId, { name: "focusFrame", frameId: framesForTab[tabId].topId, highlight: true });
+ }
+
function handleFrameFocused(request, sender) {
focusedFrame = request.frameId;
}
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.