aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authorStephen Blott2015-01-18 14:51:30 +0000
committerStephen Blott2015-01-18 14:51:30 +0000
commitf60a7073b0b9d908f72020f9239be0e1e5213a9a (patch)
tree2f3043be0e91154904f6f0a254061e0dc55a4995 /content_scripts
parent13592dc5016eff6bf84384a8cef62d1ada1ac80d (diff)
parent3b334ee221a2b226ca147eec887007eae1c17f91 (diff)
downloadvimium-f60a7073b0b9d908f72020f9239be0e1e5213a9a.tar.bz2
Merge branch 'master' into focus-input-with-memory
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/mode_insert.coffee13
1 files changed, 7 insertions, 6 deletions
diff --git a/content_scripts/mode_insert.coffee b/content_scripts/mode_insert.coffee
index 196f910b..91103a55 100644
--- a/content_scripts/mode_insert.coffee
+++ b/content_scripts/mode_insert.coffee
@@ -15,6 +15,13 @@ class InsertMode extends Mode
return @continueBubbling unless @isActive event
return @stopBubblingAndTrue unless event.type == 'keydown' and KeyboardUtils.isEscape event
DomUtils.suppressKeyupAfterEscape handlerStack
+ target = event.srcElement
+ if target and DomUtils.isFocusable target
+ # Remove the focus, so the user can't just get back into insert mode by typing in the same input box.
+ # NOTE(smblott, 2014/12/22) Including embeds for .blur() etc. here is experimental. It appears to be
+ # the right thing to do for most common use cases. However, it could also cripple flash-based sites and
+ # games. See discussion in #1211 and #1194.
+ target.blur()
@exit event, event.srcElement
@suppressEvent
@@ -63,12 +70,6 @@ class InsertMode extends Mode
if (target and target == @insertModeLock) or @global or target == undefined
@log "#{@id}: deactivating (permanent)" if @debug and @permanent and @insertModeLock
@insertModeLock = null
- if target and DomUtils.isFocusable target
- # Remove the focus, so the user can't just get back into insert mode by typing in the same input box.
- # NOTE(smblott, 2014/12/22) Including embeds for .blur() etc. here is experimental. It appears to be
- # the right thing to do for most common use cases. However, it could also cripple flash-based sites and
- # games. See discussion in #1211 and #1194.
- target.blur()
# Exit, but only if this isn't the permanently-installed instance.
if @permanent then Mode.updateBadge() else super()