From 4fb0661b509f97c8bb895651ac6c027034c81b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Tue, 14 Jun 2022 14:18:36 +0300 Subject: [PATCH] Fix force-click during drag sometimes causing collections to switch Closes #2652 --- chrome/content/zotero/components/virtualized-table.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/components/virtualized-table.jsx b/chrome/content/zotero/components/virtualized-table.jsx index 40fa84d14c..fc07b3d5c4 100644 --- a/chrome/content/zotero/components/virtualized-table.jsx +++ b/chrome/content/zotero/components/virtualized-table.jsx @@ -660,7 +660,12 @@ class VirtualizedTable extends React.Component { this._isMouseDrag = true; } - _onDragEnd = () => { + _onDragEnd = async () => { + // macOS force-click sometimes causes a second mouseup event to be fired some time later + // causing a collection change on dragend, so we add a delay here. It shouldn't cause any issues + // because isMouseDrag is only used in mouseup handler to exactly prevent from accidentally switching + // selection after dragend. + await Zotero.Promise.delay(500); this._isMouseDrag = false; }