aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content_scripts/link_hints.coffee2
-rw-r--r--content_scripts/mode.coffee6
-rw-r--r--content_scripts/vimium_frontend.coffee2
3 files changed, 9 insertions, 1 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index 1e172710..04853c22 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -70,6 +70,8 @@ LinkHints =
passInitialKeyupEvents: true
suppressAllKeyboardEvents: true
exitOnEscape: true
+ exitOnClick: true
+ exitOnScroll: true
keypress: @onKeyDownInMode.bind this, hintMarkers
@hintMode.onExit =>
diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee
index ffabc111..508b1b2c 100644
--- a/content_scripts/mode.coffee
+++ b/content_scripts/mode.coffee
@@ -101,6 +101,12 @@ class Mode
"focus": (event) => @alwaysContinueBubbling =>
@exit event if DomUtils.isFocusable event.target
+ # If @options.exitOnScroll is truthy, then the mode will exit on any scroll event.
+ if @options.exitOnScroll
+ @push
+ _name: "mode-#{@id}/exitOnScroll"
+ "scroll": (event) => @alwaysContinueBubbling => @exit event
+
# Some modes are singletons: there may be at most one instance active at any time. A mode is a singleton
# if @options.singleton is truthy. The value of @options.singleton should be the key which is intended to
# be unique. New instances deactivate existing instances with the same key.
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 3055ecea..8c28b4e6 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -192,7 +192,7 @@ window.installListeners = ->
unless installedListeners
# Key event handlers fire on window before they do on document. Prefer window for key events so the page
# can't set handlers to grab the keys before us.
- for type in [ "keydown", "keypress", "keyup", "click", "focus", "blur", "mousedown" ]
+ for type in [ "keydown", "keypress", "keyup", "click", "focus", "blur", "mousedown", "scroll" ]
do (type) -> installListener window, type, (event) -> handlerStack.bubbleEvent type, event
installListener document, "DOMActivate", (event) -> handlerStack.bubbleEvent 'DOMActivate', event
installedListeners = true