From 091cd99b6fcbb17f30e552b0c0f6461c4c1529cb Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Thu, 15 Jan 2015 18:00:18 +0000 Subject: Modes; refactoring. - refactor PostFindMode (to keep separate functionality separated). --- content_scripts/vimium_frontend.coffee | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'content_scripts/vimium_frontend.coffee') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 7d24e714..3049784e 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -364,11 +364,14 @@ extend window, id: "vimiumInputMarkerContainer" className: "vimiumReset" - new class FocusSelector extends InputController + new class FocusSelector extends Mode constructor: -> super name: "focus-selector" badge: "?" + # We share a singleton with PostFindMode. That way, a new FocusSelector displaces any existing + # PostFindMode. + singleton: PostFindMode exitOnClick: true keydown: (event) => if event.keyCode == KeyboardUtils.keyCodes.tab @@ -805,10 +808,12 @@ executeFind = (query, options) -> # preventDefault() findModeAnchorNode = document.getSelection().anchorNode - # If the anchor node is outside of the active element, then blur the active element. We don't want to leave - # behind an inappropriate active element. This fixes #1412. - if document.activeElement and not DomUtils.isDOMDescendant findModeAnchorNode, document.activeElement - document.activeElement.blur() + # TODO(smblott). Disabled. This is the wrong test. Should be reinstated when we have the right test, which + # looks like it should be "isSelected" from #1431. + # # If the anchor node not a descendent of the active element, then blur the active element. We don't want to + # # leave behind an inappropriate active element. This fixes #1412. + # if document.activeElement and not DomUtils.isDOMDescendant document.activeElement, findModeAnchorNode + # document.activeElement.blur() result -- cgit v1.2.3