From: Alexander Ebert Date: Sun, 6 Dec 2020 20:10:59 +0000 (+0100) Subject: Prevent the tooltip being selectable while the user changes the selection X-Git-Tag: 5.3.2~58 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=98b26407301f59638f28d1e01259cf8f8a59f801;p=GitHub%2FWoltLab%2FWCF.git Prevent the tooltip being selectable while the user changes the selection --- diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index e6c93a06ba..6450ff7e83 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -1155,24 +1155,19 @@ if (COMPILER_TARGET_DEFAULT) { WCF.DOMNodeInsertedHandler.addCallback('WCF.Message.Quote.Handler' + objectType.hashCode(), $.proxy(this._initContainers, this)); // Prevent the tooltip from being selectable while the touch pointer is being moved. - var timer = null; - document.addEventListener('selectionchange', (function() { - if (!this._copyQuote[0].classList.contains('active')) { - return; - } - - this._copyQuote[0].classList.add('touchForceInaccessible'); - - if (timer !== null) { - window.clearTimeout(timer); + const tooltip = this._copyQuote[0]; + document.addEventListener("touchstart", function (event) { + if (tooltip.classList.contains("active")) { + const target = event.target; + if (target !== tooltip && !tooltip.contains(target)) { + tooltip.classList.add("touchForceInaccessible"); + + document.addEventListener("touchend", function () { + tooltip.classList.remove("touchForceInaccessible"); + }, {once: true}); + } } - - timer = window.setTimeout((function() { - this._copyQuote[0].classList.remove('touchForceInaccessible'); - - timer = null; - }).bind(this), 50); - }).bind(this)); + }, {passive: true}); }, /**