From b6541b6b354f196f3121fcd2e0476f114c4f38b0 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Fri, 19 Feb 2016 17:29:59 +0000 Subject: [PATCH] Fix double-clicking an item selecting its text Cancel the selection on a double-click. This still allows selection by click-and-drag, which can be useful. --- src/gui/html/js/events.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/html/js/events.js b/src/gui/html/js/events.js index 3cab21aa..cf062dfe 100644 --- a/src/gui/html/js/events.js +++ b/src/gui/html/js/events.js @@ -354,6 +354,10 @@ function onSidebarClick(evt) { document.getElementById('pluginCardList').scrollToIndex(index); if (evt.type === 'dblclick') { + /* Double-clicking can select the item's text, clear the selection in + case that has happened. */ + window.getSelection().removeAllRanges(); + const card = document.getElementById(evt.target.getAttribute('data-id')); if (!card.classList.contains('flip')) { document.getElementById(evt.target.getAttribute('data-id')).onShowEditor();