From d04f2a57771d04d1014699ef47b147d1c11380bc Mon Sep 17 00:00:00 2001 From: Jez Ng Date: Fri, 2 Mar 2012 18:24:00 -0500 Subject: Only show hints for focusable input elements. Closes #496. --- linkHints.js | 3 ++- vimiumFrontend.js | 3 ++- 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); })(); -- cgit v1.2.3