diff options
| -rw-r--r-- | content_scripts/link_hints.coffee | 17 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 4 |
2 files changed, 19 insertions, 2 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 15af15c5..8e106b0f 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -167,6 +167,23 @@ class LinkHintsMode element.getAttribute("aria-disabled")?.toLowerCase() in ["", "true"]) return [] # This element should never have a link hint. + # Check for AngularJS listeners on the element. + @checkForAngularJs ?= do -> + angularElements = document.getElementsByClassName "ng-scope" + if angularElements.length == 0 + -> false + else + ngAttributes = [] + for prefix in [ '', 'data-', 'x-' ] + for separator in [ '-', ':', '_' ] + ngAttributes.push "#{prefix}ng#{separator}click" + (element) -> + for attribute in ngAttributes + return true if element.hasAttribute attribute + false + + isClickable ||= @checkForAngularJs element + # Check for attributes that make an element clickable regardless of its tagName. if (element.hasAttribute("onclick") or element.getAttribute("role")?.toLowerCase() in ["button", "link"] or diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 8f4c7e82..9d850419 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -429,7 +429,7 @@ extend window, hints[selectedInputIndex].classList.add 'internalVimiumSelectedInputHint' # Deactivate any active modes on this element (PostFindMode, or a suspended edit mode). @deactivateSingleton visibleInputs[selectedInputIndex].element - visibleInputs[selectedInputIndex].element.focus() + DomUtils.simulateSelect visibleInputs[selectedInputIndex].element @suppressEvent else unless event.keyCode == KeyboardUtils.keyCodes.shiftKey @exit() @@ -442,7 +442,7 @@ extend window, # Deactivate any active modes on this element (PostFindMode, or a suspended edit mode). @deactivateSingleton visibleInputs[selectedInputIndex].element - visibleInputs[selectedInputIndex].element.focus() + DomUtils.simulateSelect visibleInputs[selectedInputIndex].element if visibleInputs.length == 1 @exit() return |
