From 4ae1ea1daf297f11ae3c89d725d05ea7e76d3f47 Mon Sep 17 00:00:00 2001 From: abaevbog Date: Thu, 4 Sep 2025 02:50:50 -0500 Subject: [PATCH] citation dlg: Don't remove bubbles on Backspace on Windows/Linux (#5526) On non-macOS platforms, Delete (not Backspace) on a table row will remove all of this item's bubbles from the citation. This is to be consistent with similar delete operation handling in other tables. On macOS, this is still done via Backspace as before. Per https://github.com/zotero/zotero/pull/5518#discussion_r2310293170 --- chrome/content/zotero/integration/citationDialog.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/integration/citationDialog.js b/chrome/content/zotero/integration/citationDialog.js index c1755d4f7f..3c889861fb 100644 --- a/chrome/content/zotero/integration/citationDialog.js +++ b/chrome/content/zotero/integration/citationDialog.js @@ -611,7 +611,7 @@ class LibraryLayout extends Layout { itemsTree.addEventListener("mouseup", event => this._handleItemsViewRowClick(event), true); // manually handle hover effect on +/- icon, since css :hover applies to the entire row itemsTree.addEventListener("mousemove", event => this._handleItemsViewMouseMove(event)); - // handle backspace to remove an item from citation + // handle backspace/delete to remove an item from citation itemsTree.addEventListener("keypress", event => this._handleItemsViewKeyPress(event)); // only highlight bubbles of selected rows when the focus is in itemTree // when focus leaves the items table, bubbles highlighting is removed @@ -733,9 +733,9 @@ class LibraryLayout extends Layout { hoveredOverIcon.classList.add("hover"); } - // backspace in itemsView deletes items from the citation + // backspace/delete in itemsView deletes items from the citation _handleItemsViewKeyPress(event) { - if (event.key == "Backspace") { + if (event.key == "Delete" || Zotero.isMac && event.key == "Backspace") { let itemsToRemove = this.itemsView.getSelectedItems(); for (let item of itemsToRemove) { let items = CitationDataManager.getItems({ itemID: item.id });