From 0237d64daed59ad00b64a998c2d619fb78278633 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Sat, 20 May 2017 18:56:18 +0200 Subject: [PATCH] hints: do not execute `click` in addition to opening hints When the element which we are about to open has a "href" attribute, we will execute either `window.open` or set the `window.location.href` attribute to the target's reference. But as we forgot to call `return` here, we will also execute the code to open elements without "href" attribute. In the case of opening a new window, we will now first open the new window and then also set the current window's URL to the target, which is obviously wrong. Fix the issue by putting the excution of `click()` inside an else-branch. --- src/scripts/hints.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scripts/hints.js b/src/scripts/hints.js index ceb86ed..4e8fd28 100644 --- a/src/scripts/hints.js +++ b/src/scripts/hints.js @@ -400,8 +400,9 @@ var hints = Object.freeze((function(){ } else { window.location.href = e.getAttribute('href'); } + } else { + window.setTimeout(function() {e.click();}, 0); } - window.setTimeout(function() {e.click();}, 0); } /* set focus on hint with given index valid hints array */ -- 2.20.1