From 20c1fef75eef7a203cc550f2d035ee5c82be5bd6 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Mon, 18 Apr 2016 10:28:22 +0100 Subject: Simplify find-mode exit event. Previously, we were transferring a "transferable event" from the HUD UI component to the content script (when find mode exits). In addition to being unnecessary, this was triggering a warning in the console because we were reading *all* of the events keys, including one which triggers a "this is being deprecated" warning. The approach here is simpler, transfers less data and avoids triggering the warning. --- content_scripts/hud.coffee | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/hud.coffee b/content_scripts/hud.coffee index 4ba8557c..0d3a6f95 100644 --- a/content_scripts/hud.coffee +++ b/content_scripts/hud.coffee @@ -53,7 +53,8 @@ HUD = else @tween.fade 0, 150, => @hide true, updateIndicator - hideFindMode: (data) -> + # These parameters describe the reason find mode is exiting, and come from the HUD UI component. + hideFindMode: ({exitEventIsEnter, exitEventIsEscape}) -> @findMode.checkReturnToViewPort() # An element won't receive a focus event if the search landed on it while we were in the HUD iframe. To @@ -65,13 +66,11 @@ HUD = document.activeElement?.blur() focusNode?.focus() - {event} = data - - if event.keyCode == keyCodes.enter + if exitEventIsEnter handleEnterForFindMode() if FindMode.query.hasResults postExit = -> new PostFindMode - else if KeyboardUtils.isEscape event + else if exitEventIsEscape # We don't want FindMode to handle the click events that handleEscapeForFindMode can generate, so we # wait until the mode is closed before running it. postExit = handleEscapeForFindMode -- cgit v1.2.3