From 7751801c8760bf168bce63ab754a439e0b800dd8 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 9 Jun 2026 14:50:18 -0400 Subject: [PATCH] Sort batch-edit value suggestions by frequency descending And remove counts, which are confusing --- chrome/content/zotero/elements/itemBox.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/elements/itemBox.js b/chrome/content/zotero/elements/itemBox.js index a965f9f1ad..6cf5dc5fe2 100644 --- a/chrome/content/zotero/elements/itemBox.js +++ b/chrome/content/zotero/elements/itemBox.js @@ -2041,8 +2041,10 @@ } } let options = Object.keys(optionCounts); - options.sort((a, b) => a.localeCompare(b, undefined, { sensitivity: 'base', numeric: true })); - let optionLabels = options.map(o => `[${optionCounts[o]}] ${o}`); + // Sort by frequency (most common first), then alphanumerically + options.sort((a, b) => + optionCounts[b] - optionCounts[a] + || a.localeCompare(b, undefined, { sensitivity: 'base', numeric: true })); valueElement.multipleValues = true; valueElement.value = ''; valueElement.placeholder = Zotero.getString('item-pane-batch-editing-multiple-values-placeholder'); @@ -2056,8 +2058,7 @@ search: 'zotero-options', searchParam: JSON.stringify({ search: 'zotero-options', - options: optionLabels, - optionValues: options, + options: options, includeNoValue: true }), popup: 'PopupAutoComplete',