aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJez Ng2012-03-02 18:24:00 -0500
committerJez Ng2012-03-02 18:32:37 -0500
commitd04f2a57771d04d1014699ef47b147d1c11380bc (patch)
tree951778f04edbffe90c041c272bb6b2df7d877ac5
parent5c6182d794e109515ccc30e2122e43a215c67077 (diff)
downloadvimium-d04f2a57771d04d1014699ef47b147d1c11380bc.tar.bz2
Only show hints for focusable input elements.
Closes #496.
-rw-r--r--linkHints.js3
-rw-r--r--vimiumFrontend.js3
2 files changed, 4 insertions, 2 deletions
diff --git a/linkHints.js b/linkHints.js
index 53760b95..456f634c 100644
--- a/linkHints.js
+++ b/linkHints.js
@@ -41,7 +41,8 @@ var linkHints = {
* The final expression will be something like "//button | //xhtml:button | ..."
* We use translate() instead of lower-case() because Chrome only supports XPath 1.0.
*/
- clickableElementsXPath: domUtils.makeXPath(["a", "area[@href]", "textarea", "button", "select","input[not(@type='hidden')]",
+ clickableElementsXPath: domUtils.makeXPath(["a", "area[@href]", "textarea", "button", "select",
+ "input[not(@type='hidden' or @disabled or @readonly)]",
"*[@onclick or @tabindex or @role='link' or @role='button' or " +
"@contenteditable='' or translate(@contenteditable, 'TRUE', 'true')='true']"]),
diff --git a/vimiumFrontend.js b/vimiumFrontend.js
index d1f0aac5..8a4da834 100644
--- a/vimiumFrontend.js
+++ b/vimiumFrontend.js
@@ -32,7 +32,8 @@ var activatedElement;
var textInputXPath = (function() {
var textInputTypes = ["text", "search", "email", "url", "number", "password"];
var inputElements = ["input[" +
- textInputTypes.map(function (type) { return '@type="' + type + '"'; }).join(" or ") + "or not(@type)]",
+ "(" + textInputTypes.map(function(type) {return '@type="' + type + '"'}).join(" or ") + "or not(@type))" +
+ " and not(@disabled or @readonly)]",
"textarea", "*[@contenteditable='' or translate(@contenteditable, 'TRUE', 'true')='true']"];
return domUtils.makeXPath(inputElements);
})();