Workaround for the selection of the quote tooltip
authorAlexander Ebert <ebert@woltlab.com>
Wed, 9 Mar 2022 16:19:40 +0000 (17:19 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 9 Mar 2022 16:19:40 +0000 (17:19 +0100)
Fixes https://www.woltlab.com/community/thread/294684-sprung-zum-seitenanfang-beim-markieren-auf-mobilen-ger%C3%A4ten/

ts/WoltLabSuite/Core/Ui/Message/Quote.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Quote.js
wcfsetup/install/files/style/ui/tooltip.scss

index e351336f7bb727a3152ba8022c7b15258848c971..b3cfee6dd2342992244b4b406bf5fdf1779012ca 100644 (file)
@@ -90,22 +90,20 @@ export class UiMessageQuote implements AjaxCallbackObject {
     document.addEventListener(
       "touchstart",
       (event) => {
-        if (this.copyQuote.classList.contains("active")) {
-          const target = event.target as HTMLElement;
-          if (target !== this.copyQuote && !this.copyQuote.contains(target)) {
-            this.copyQuote.classList.add("touchForceInaccessible");
-
-            document.addEventListener(
-              "touchend",
-              () => {
-                this.copyQuote.classList.remove("touchForceInaccessible");
-              },
-              { once: true },
-            );
-          }
+        const target = event.target as HTMLElement;
+        if (target !== this.copyQuote && !this.copyQuote.contains(target)) {
+          this.copyQuote.classList.add("touchForceInaccessible");
+
+          document.addEventListener(
+            "touchend",
+            () => {
+              this.copyQuote.classList.remove("touchForceInaccessible");
+            },
+            { once: true, passive: false },
+          );
         }
       },
-      { passive: true },
+      { passive: false },
     );
   }
 
index 36b5b25c157af8a101453448ecdfe7361e9348ca..f2d88faf36918a856c1c2328b6a6508a4e35e71a 100644 (file)
@@ -38,16 +38,14 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Core", "../../Event/
             Listener_1.default.add("UiMessageQuote", () => this.initContainers());
             // Prevent the tooltip from being selectable while the touch pointer is being moved.
             document.addEventListener("touchstart", (event) => {
-                if (this.copyQuote.classList.contains("active")) {
-                    const target = event.target;
-                    if (target !== this.copyQuote && !this.copyQuote.contains(target)) {
-                        this.copyQuote.classList.add("touchForceInaccessible");
-                        document.addEventListener("touchend", () => {
-                            this.copyQuote.classList.remove("touchForceInaccessible");
-                        }, { once: true });
-                    }
+                const target = event.target;
+                if (target !== this.copyQuote && !this.copyQuote.contains(target)) {
+                    this.copyQuote.classList.add("touchForceInaccessible");
+                    document.addEventListener("touchend", () => {
+                        this.copyQuote.classList.remove("touchForceInaccessible");
+                    }, { once: true, passive: false });
                 }
-            }, { passive: true });
+            }, { passive: false });
         }
         /**
          * Initializes message containers.
index b39e04be2c629b9133c45ad325db34f787c308a8..165cdc8af2ba51da24a4a2c357edab7866f0a110 100644 (file)
@@ -51,7 +51,7 @@
        z-index: 350;
 
        &.touchForceInaccessible {
-               display: none;
+               pointer-events: none;
        }
 
        @include screen-md-down {