From c5d6b80cb6eae99aed461e20c99a286eaf352a2a Mon Sep 17 00:00:00 2001 From: Ramiro Araujo Date: Wed, 9 Nov 2016 13:23:48 -0300 Subject: treat select element as an input, setting focus to it --- content_scripts/link_hints.coffee | 2 +- tests/dom_tests/dom_tests.coffee | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 02b8d656..0014e20a 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -394,7 +394,7 @@ class LinkHintsMode clickActivator = (modifiers) -> (link) -> DomUtils.simulateClick link, modifiers linkActivator = @mode.linkActivator ? clickActivator @mode.clickModifiers # TODO: Are there any other input elements which should not receive focus? - if clickEl.nodeName.toLowerCase() == "input" and clickEl.type not in ["button", "submit"] + if clickEl.nodeName.toLowerCase() in ["input", "select"] and clickEl.type not in ["button", "submit"] clickEl.focus() linkActivator clickEl diff --git a/tests/dom_tests/dom_tests.coffee b/tests/dom_tests/dom_tests.coffee index eab47546..68611230 100644 --- a/tests/dom_tests/dom_tests.coffee +++ b/tests/dom_tests/dom_tests.coffee @@ -188,6 +188,11 @@ context "Test link hints for focusing input elements correctly", testDiv.appendChild input inputs.push input + # manually add the select element to test focus + input = document.createElement "select" + testDiv.appendChild input + inputs.push input + tearDown -> document.getElementById("test-div").innerHTML = "" -- cgit v1.2.3