aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/mode.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'content_scripts/mode.coffee')
-rw-r--r--content_scripts/mode.coffee7
1 files changed, 7 insertions, 0 deletions
diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee
index 7877d97c..fa583a1c 100644
--- a/content_scripts/mode.coffee
+++ b/content_scripts/mode.coffee
@@ -86,6 +86,13 @@ class Mode
_name: "mode-#{@id}/exitOnClick"
"click": (event) => @alwaysContinueBubbling => @exit event
+ #If @options.exitOnFocus is truthy, then the mode will exit whenever a focusable element is activated.
+ if @options.exitOnFocus
+ @push
+ _name: "mode-#{@id}/exitOnFocus"
+ "focus": (event) => @alwaysContinueBubbling =>
+ @exit event if DomUtils.isFocusable event.target
+
# 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.