From da9da7ec622b4434c5fefeb64efdfc220e3ba95f Mon Sep 17 00:00:00 2001 From: Caleb John Date: Tue, 23 Feb 2021 03:59:08 -0700 Subject: [PATCH] Desktop: Reset window hash to allow clicking an anchor multiple times (#4538) --- packages/app-desktop/gui/note-viewer/index.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/app-desktop/gui/note-viewer/index.html b/packages/app-desktop/gui/note-viewer/index.html index 9a5591d56..0769eb43f 100644 --- a/packages/app-desktop/gui/note-viewer/index.html +++ b/packages/app-desktop/gui/note-viewer/index.html @@ -395,6 +395,16 @@ } } + window.addEventListener('hashchange', webviewLib.logEnabledEventHandler(e => { + if (!window.location.hash) return; + + // The timeout is necessary to prevent a race condition and give time for the window to scroll + setTimeout(() => { + // Reset the window hash to allow clicking on the same anchor link more than once + window.location.hash = ''; + }, 100); + })); + document.addEventListener('contextmenu', webviewLib.logEnabledEventHandler(event => { let element = event.target;