From 898c75a05ceead0e0b63acb5c37abfdc9ec185d4 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Mon, 11 Sep 2023 15:39:54 +0200 Subject: [PATCH] FIX: ensures swipe works with scroll (#23508) - do not prevent the event (it was a violation anyways as the touchstart is passive) - waits for at least 25px horizontal move before showing the remove action, it avoids showing the remove while scrolling and moving a little bit horizontally --- .../javascripts/discourse/components/chat-channel-row.gjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-row.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-row.gjs index 358f1ba1106..0c4b5322781 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-row.gjs +++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-row.gjs @@ -166,8 +166,6 @@ export default class ChatChannelRow extends Component { @bind onSwipe(event) { - event.preventDefault(); - const touchX = event.changedTouches[0].screenX; const diff = this.initialX - touchX; @@ -193,8 +191,10 @@ export default class ChatChannelRow extends Component { this.isCancelling = !this._towardsThreshold; } - this.actionButton.style.width = diff + "px"; - this.swipableRow.style.left = -(this.initialX - touchX) + "px"; + if (diff > 25) { + this.actionButton.style.width = diff + "px"; + this.swipableRow.style.left = -(this.initialX - touchX) + "px"; + } } @bind