aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authorStephen Blott2015-01-18 14:43:02 +0000
committerStephen Blott2015-01-18 14:44:55 +0000
commit3b334ee221a2b226ca147eec887007eae1c17f91 (patch)
tree3f340c9b5a26d7a3416769585af0f7c9ca2779d4 /content_scripts
parent0f2343dbc73b4bbca856b777b8a3c11b0cffd2cd (diff)
downloadvimium-3b334ee221a2b226ca147eec887007eae1c17f91.tar.bz2
Modes; fix error for exit insert mode.
We were blurring the active input element whenever we exit insert mode (my bad). It should only be blurred when we exit insert mode via Escape.
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()