aboutsummaryrefslogtreecommitdiffstats
path: root/pages/vomnibar.coffee
diff options
context:
space:
mode:
authorStephen Blott2016-04-15 16:51:18 +0100
committerStephen Blott2016-04-16 14:15:33 +0100
commit5bfe6dc5d1e0aeb1ab3e372821997d83ba5c9164 (patch)
tree174c58b552cc0b869764d2dd28f14bb3f010ef2c /pages/vomnibar.coffee
parent014f53fb091ac8672d3efbeca13a494c15d8afcb (diff)
downloadvimium-5bfe6dc5d1e0aeb1ab3e372821997d83ba5c9164.tar.bz2
Rework UI component focus handling.
The code to handle the focus for UI components has been tweaked and adapted over time, and has become quite complicated (and brittle). This reworks it from scratch, and co-locates similar code which does related things. Fixes #2099.
Diffstat (limited to 'pages/vomnibar.coffee')
-rw-r--r--pages/vomnibar.coffee14
1 files changed, 7 insertions, 7 deletions
diff --git a/pages/vomnibar.coffee b/pages/vomnibar.coffee
index 0332b12f..449c0bac 100644
--- a/pages/vomnibar.coffee
+++ b/pages/vomnibar.coffee
@@ -38,7 +38,7 @@ Vomnibar =
class VomnibarUI
constructor: ->
@refreshInterval = 0
- @postHideCallback = null
+ @onHiddenCallback = null
@initDom()
setQuery: (query) -> @input.value = query
@@ -56,14 +56,14 @@ class VomnibarUI
# 3. Only once the "hidden" message is received here is any required action invoked (in onHidden).
# This ensures that the vomnibar is actually hidden before any new tab is created, and avoids flicker after
# opening a link in a new tab then returning to the original tab (see #1485).
- hide: (@postHideCallback = null) ->
+ hide: (@onHiddenCallback = null) ->
UIComponentServer.postMessage "hide"
@reset()
- @completer?.reset()
onHidden: ->
- @postHideCallback?()
- @postHideCallback = null
+ @onHiddenCallback?()
+ @onHiddenCallback = null
+ @reset()
reset: ->
@clearUpdateTimer()
@@ -75,6 +75,7 @@ class VomnibarUI
@selection = @initialSelectionValue
@keywords = []
@seenTabToOpenCompletionList = false
+ @completer?.reset()
updateSelection: ->
# For custom search engines, we suppress the leading term (e.g. the "w" of "w query terms") within the
@@ -331,10 +332,9 @@ class BackgroundCompleter
UIComponentServer.registerHandler (event) ->
switch event.data.name ? event.data
- when "frameFocused" then Vomnibar.hide()
when "hide" then Vomnibar.hide()
when "hidden" then Vomnibar.onHidden()
- else Vomnibar.activate event.data
+ when "activate" then Vomnibar.activate event.data
root = exports ? window
root.Vomnibar = Vomnibar