From 2d4a086819889466ff6ced62364d4bc01729bfb5 Mon Sep 17 00:00:00 2001 From: Tom Najdek Date: Mon, 21 Jul 2025 13:03:41 +0200 Subject: [PATCH] Fix picking a type for the creator removes the entry. Close #5396 --- chrome/content/zotero/elements/itemBox.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/elements/itemBox.js b/chrome/content/zotero/elements/itemBox.js index ac68be23a7..fe9ed81421 100644 --- a/chrome/content/zotero/elements/itemBox.js +++ b/chrome/content/zotero/elements/itemBox.js @@ -1119,7 +1119,8 @@ rowLabel.appendChild(labelWrapper); let label = this.createLabelElement({ id: 'creator-type-label-inner', - text: Zotero.getString('creatorTypes.' + Zotero.CreatorTypes.getName(typeID)) + text: Zotero.getString('creatorTypes.' + Zotero.CreatorTypes.getName(typeID)), + skipEventHandlers: true, }); labelWrapper.appendChild(label); @@ -1562,7 +1563,7 @@ return openLink; } - createLabelElement({ text, id, attributes, classList }) { + createLabelElement({ text, id, attributes, classList, skipEventHandlers = false } = {}) { let label = document.createElement('label'); label.classList.add('key', ...classList || []); if (text) label.textContent = text; @@ -1573,7 +1574,7 @@ } } // On click of the label, toggle the focus of the value field - if (this.editable) { + if (this.editable && !skipEventHandlers) { label.addEventListener('mousedown', (event) => { // Prevent default focus/blur behavior - we implement our own below event.preventDefault();