From b9e1923656b75a2a68c3204bbc318cc2829c1bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Mon, 8 Nov 2021 14:06:23 +0200 Subject: [PATCH] Fix rows not deselecting with single click on one item. Closes #2241 --- chrome/content/zotero/components/virtualized-table.jsx | 4 +--- chrome/content/zotero/itemTree.jsx | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/components/virtualized-table.jsx b/chrome/content/zotero/components/virtualized-table.jsx index b2eed717f6..0b9f75816c 100644 --- a/chrome/content/zotero/components/virtualized-table.jsx +++ b/chrome/content/zotero/components/virtualized-table.jsx @@ -687,9 +687,7 @@ class VirtualizedTable extends React.Component { this._isMouseDrag = false; return; } - if (shiftSelect || toggleSelection) { - this._onSelection(index, shiftSelect, toggleSelection); - } + this._onSelection(index, shiftSelect, toggleSelection); } _activateNode = (event, indices) => { diff --git a/chrome/content/zotero/itemTree.jsx b/chrome/content/zotero/itemTree.jsx index e08df005c2..bc4907cecb 100644 --- a/chrome/content/zotero/itemTree.jsx +++ b/chrome/content/zotero/itemTree.jsx @@ -2664,13 +2664,14 @@ var ItemTree = class ItemTree extends LibraryTree { this.onDrop(e, index); }, { passive: true }); } - div.addEventListener('mousedown', e => this._handleRowMouseDown(e, index), { passive : true }); + div.addEventListener('mousedown', this._handleRowMouseUpDown, { passive: true }); + div.addEventListener('mouseup', this._handleRowMouseUpDown, { passive: true }); } return div; }; - _handleRowMouseDown = (event, index) => { + _handleRowMouseUpDown = (event) => { const modifierIsPressed = ['ctrlKey', 'metaKey', 'shiftKey', 'altKey'].some(key => event[key]); if (this.collectionTreeRow.isDuplicates() && !modifierIsPressed) { this.duplicateMouseSelection = true;