diff options
| -rw-r--r-- | lib/domUtils.js | 9 | ||||
| -rw-r--r-- | linkHints.js | 13 |
2 files changed, 14 insertions, 8 deletions
diff --git a/lib/domUtils.js b/lib/domUtils.js index cfb1202b..c1bdcdde 100644 --- a/lib/domUtils.js +++ b/lib/domUtils.js @@ -105,4 +105,13 @@ var domUtils = { } }, + // momentarily flash a border around an element to give user some visual feedback + flashElement: function(element) { + var oldBorderValue = element.style.border; + element.style.border = '1px solid #66f'; + setTimeout(function() { + element.style.border = oldBorderValue; + }, 400); + }, + }; diff --git a/linkHints.js b/linkHints.js index e25dab9a..8f278175 100644 --- a/linkHints.js +++ b/linkHints.js @@ -206,14 +206,11 @@ var linkHints = { domUtils.simulateSelect(matchedLink); this.deactivateMode(delay, function() { that.delayMode = false; }); } else { - // focus the link momentarily to give user some visual feedback - matchedLink.focus(); - setTimeout(function() { - // TODO(int3): do this for @role='link' and similar elements as well - var nodeName = matchedLink.nodeName.toLowerCase(); - if (nodeName == 'a' || nodeName == 'button') - matchedLink.blur(); - }, 400); + // TODO figure out which other input elements should not receive focus + if (matchedLink.nodeName.toLowerCase() === 'input' && + matchedLink.type !== 'button') + matchedLink.focus(); + domUtils.flashElement(matchedLink); this.linkActivator(matchedLink); if (this.shouldOpenWithQueue) { this.deactivateMode(delay, function() { |
