aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2015-03-08 10:03:08 +0000
committerStephen Blott2015-03-08 10:03:08 +0000
commite49b701fb813e147a187058fe7eda4bfa2d40bec (patch)
tree9aa44558ca52fa2674a4507f8f605085d86dc14f
parentae60abb94665446200db8a750bbc1362895d04d2 (diff)
downloadvimium-e49b701fb813e147a187058fe7eda4bfa2d40bec.tar.bz2
Better documentation of closing sequence for vomnibar.
-rw-r--r--pages/vomnibar.coffee16
1 files changed, 10 insertions, 6 deletions
diff --git a/pages/vomnibar.coffee b/pages/vomnibar.coffee
index 906aa0f3..06ec9ee9 100644
--- a/pages/vomnibar.coffee
+++ b/pages/vomnibar.coffee
@@ -61,11 +61,21 @@ class VomnibarUI
setForceNewTab: (forceNewTab) -> @forceNewTab = forceNewTab
+ # The sequence of events when the vomnibar is hidden is as follows:
+ # 1. Post a "hide" message to the host page.
+ # 2. The host page hides the vomnibar and posts back a "hidden" message.
+ # 3. Only once "hidden" message is received here is any required action (callback) invoked (in onHidden).
+ # This ensures that the vomnibar is actually hidden, and avoids flicker after opening a link in a new tab
+ # (see #1485).
hide: (callback = null) ->
UIComponentServer.postMessage "hide"
@reset()
@postHideCallback = callback
+ onHidden: ->
+ @postHideCallback?()
+ @postHideCallback = null
+
reset: ->
@completionList.style.display = ""
@input.value = ""
@@ -73,12 +83,6 @@ class VomnibarUI
@completions = []
@selection = @initialSelectionValue
- # Called after the vomnibar has been hidden. We wait until after the vomnibar has been hidden to avoid
- # vomnibar flicker (see #1485).
- onHidden: ->
- @postHideCallback?()
- @postHideCallback = null
-
updateSelection: ->
# We retain global state here (previousAutoSelect) to tell if a search item (for which autoSelect is set)
# has just appeared or disappeared. If that happens, we set @selection to 0 or -1.