From bd48e3671181fcd10ede588e96aa45f0d81a07d4 Mon Sep 17 00:00:00 2001 From: Jez Ng Date: Sun, 26 Feb 2012 23:48:38 -0500 Subject: Revert "Exit insert mode upon tab switch. Closes #314." This reverts commit 9e14b51f7761fa35acdbf7e5abbb7bc59928a6e2. Conflicts: vimiumFrontend.js --- vimiumFrontend.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/vimiumFrontend.js b/vimiumFrontend.js index 286dfe3e..be69b87f 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -188,7 +188,7 @@ function initializeWhenEnabled() { document.addEventListener("keypress", onKeypress, true); document.addEventListener("keyup", onKeyup, true); document.addEventListener("focus", onFocusCapturePhase, true); - window.addEventListener("blur", onBlurCapturePhase, true); + document.addEventListener("blur", onBlurCapturePhase, true); document.addEventListener("DOMActivate", onDOMActivate, true); enterInsertModeIfElementIsFocused(); } @@ -563,12 +563,7 @@ function onFocusCapturePhase(event) { } function onBlurCapturePhase(event) { - if (event.target == window) - // At this point, we will have exited insert mode already, but the browser remembers which element last - // had focus, and fires a focus event on it when the window regains focus. We blur this element to prevent - // implicit insert mode from reactivating when we switch back to this tab. - document.activeElement.blur(); - else if (isFocusable(event.target)) + if (isFocusable(event.target)) exitInsertMode(event.target); } -- cgit v1.2.3