diff options
| author | Stephen Blott | 2016-04-15 16:51:18 +0100 |
|---|---|---|
| committer | Stephen Blott | 2016-04-16 14:15:33 +0100 |
| commit | 5bfe6dc5d1e0aeb1ab3e372821997d83ba5c9164 (patch) | |
| tree | 174c58b552cc0b869764d2dd28f14bb3f010ef2c /content_scripts/hud.coffee | |
| parent | 014f53fb091ac8672d3efbeca13a494c15d8afcb (diff) | |
| download | vimium-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 'content_scripts/hud.coffee')
| -rw-r--r-- | content_scripts/hud.coffee | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/content_scripts/hud.coffee b/content_scripts/hud.coffee index bbf7c5e9..fb1fd657 100644 --- a/content_scripts/hud.coffee +++ b/content_scripts/hud.coffee @@ -25,12 +25,12 @@ HUD = show: (text) -> return unless @isReady() clearTimeout(@_showForDurationTimerId) - @hudUI.show {name: "show", text} + @hudUI.activate {name: "show", text} @tween.fade 1.0, 150 showFindMode: (@findMode = null) -> return unless @isReady() - @hudUI.show {name: "showFindMode", text: ""} + @hudUI.activate name: "showFindMode", text: "" @tween.fade 1.0, 150 search: (data) -> @@ -50,9 +50,7 @@ HUD = clearTimeout(@_showForDurationTimerId) @tween.stop() if immediate - unless updateIndicator - @hudUI.hide() - @hudUI.postMessage {name: "hide"} + @hudUI.hide() Mode.setIndicator() if updateIndicator else @tween.fade 0, 150, => @hide true, updateIndicator @@ -60,9 +58,9 @@ HUD = hideFindMode: (data) -> @findMode.checkReturnToViewPort() - # An element element won't receive a focus event if the search landed on it while we were in the HUD - # iframe. To end up with the correct modes active, we create a focus/blur event manually after refocusing - # this window. + # An element won't receive a focus event if the search landed on it while we were in the HUD iframe. To + # end up with the correct modes active, we create a focus/blur event manually after refocusing this + # window. window.focus() focusNode = DomUtils.getSelectionFocusElement() |
