about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/components
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-03-05 23:17:09 +0100
committerThibG <thib@sitedethib.com>2019-03-06 00:20:43 +0100
commite80fabfd84c1e2d157ca1cd536f68f3c75f011c1 (patch)
treea90ae7c8d2536a852dbcf3758371eb7a29b6a686 /app/javascript/flavours/glitch/components
parentbd3567b3f8988998384f5031daa2fcfc06393853 (diff)
Fix toots opening in dynamic column when trying to interact with them
This fixes inline preview cards and polls, preventing them from opening
the toot in detailed view when clicking on an interactive element.
Diffstat (limited to 'app/javascript/flavours/glitch/components')
-rw-r--r--app/javascript/flavours/glitch/components/status_content.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/components/status_content.js b/app/javascript/flavours/glitch/components/status_content.js
index c60d63f9a..98a34ebaf 100644
--- a/app/javascript/flavours/glitch/components/status_content.js
+++ b/app/javascript/flavours/glitch/components/status_content.js
@@ -100,8 +100,12 @@ export default class StatusContent extends React.PureComponent {
     const [ startX, startY ] = this.startXY;
     const [ deltaX, deltaY ] = [Math.abs(e.clientX - startX), Math.abs(e.clientY - startY)];
 
-    if (e.target.localName === 'button' || e.target.localName == 'video' || e.target.localName === 'a' || (e.target.parentNode && (e.target.parentNode.localName === 'button' || e.target.parentNode.localName === 'a'))) {
-      return;
+    let element = e.target;
+    while (element) {
+      if (element.localName === 'button' || element.localName === 'video' || element.localName === 'a' || element.localName === 'label') {
+        return;
+      }
+      element = element.parentNode;
     }
 
     if (deltaX + deltaY < 5 && e.button === 0 && parseClick) {