diff options
| author | Phil Crosby | 2009-12-31 02:40:10 -0500 | 
|---|---|---|
| committer | Phil Crosby | 2009-12-31 02:40:10 -0500 | 
| commit | 54394236e589be03c39b76fdfea861ba171193f1 (patch) | |
| tree | de49186b22bae9abad9bd0f2c5a5997afdd31cbf | |
| parent | 693d1a7a73e58b9e84badc09030d8edf79f2ce1a (diff) | |
| download | vimium-54394236e589be03c39b76fdfea861ba171193f1.tar.bz2 | |
Fix a regression where buttons were not clickable via link-hints
| -rw-r--r-- | linkHints.js | 12 | 
1 files changed, 11 insertions, 1 deletions
| diff --git a/linkHints.js b/linkHints.js index 9831f3fe..047cbcae 100644 --- a/linkHints.js +++ b/linkHints.js @@ -161,8 +161,9 @@ function updateLinkHints() {      deactivateLinkHintsMode();    else if (linksMatched.length == 1) {      var matchedLink = linksMatched[0]; -    if (isInputOrText(matchedLink)) { +    if (isSelectable(matchedLink)) {        matchedLink.focus(); +      // When focusing a textbox, put the selection caret at the end of the textbox's contents.        matchedLink.setSelectionRange(matchedLink.value.length, matchedLink.value.length);      } else {        // When we're opening the link in the current tab, don't navigate to the selected link immediately; @@ -178,6 +179,15 @@ function updateLinkHints() {  }  /* + * Selectable means the element has a text caret; this is not the same as "focusable". + */ +function isSelectable(element) { +  var selectableTypes = ["search", "text", "password"]; +  return (element.tagName == "INPUT" && selectableTypes.indexOf(element.type) >= 0) || +      element.tagName == "TEXTAREA"; +} + +/*   * Hides link hints which do not match the given search string. To allow the backspace key to work, this   * will also show link hints which do match but were previously hidden.   */ | 
