diff options
| author | Stephen Blott | 2015-03-09 08:49:37 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2015-03-09 08:49:37 +0000 | 
| commit | f407fe2feba1ffa4ac3fdd50e431ac51b8ec630f (patch) | |
| tree | 05894fd4e1bd06066f70bf708e5969e10fa5205f | |
| parent | fabe391e80e9f90b656786fb58795b9769457253 (diff) | |
| download | vimium-f407fe2feba1ffa4ac3fdd50e431ac51b8ec630f.tar.bz2 | |
Pass keyup events after entering link-hint mode.
The page (or another extension) sees keydown events (such as shift)
before entering link-hint mode.  So we need to also pass the
corresponding keyup events.
Fixes #1522.
| -rw-r--r-- | content_scripts/link_hints.coffee | 1 | ||||
| -rw-r--r-- | content_scripts/mode.coffee | 10 | 
2 files changed, 11 insertions, 0 deletions
| diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index f904c7d5..72fde9e1 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -68,6 +68,7 @@ LinkHints =      @hintMode = new Mode        name: "hint/#{mode.name}"        badge: "#{mode.key}?" +      passInitialKeyupEvents: true        keydown: @onKeyDownInMode.bind(this, hintMarkers),        # trap all key events        keypress: -> false diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee index fa583a1c..bded402c 100644 --- a/content_scripts/mode.coffee +++ b/content_scripts/mode.coffee @@ -120,6 +120,16 @@ class Mode              @registerStateChange?()          registerKeyQueue: ({ keyQueue: keyQueue }) => @alwaysContinueBubbling => @keyQueue = keyQueue +    # If @options.passInitialKeyupEvents is set, then we pass initial non-printable keyup events to the page +    # or to other extensions (because the corresponding keydown events were passed).  This is used when +    # activating link hints, see #1522. +    if @options.passInitialKeyupEvents +      @push +        _name: "mode-#{@id}/passInitialKeyupEvents" +        keydown: => @alwaysContinueBubbling -> handlerStack.remove() +        keyup: (event) => +          if KeyboardUtils.isPrintable event then @stopBubblingAndFalse else @stopBubblingAndTrue +      Mode.modes.push @      Mode.updateBadge()      @logModes() | 
