From db4a79838badd9872a84309f26298c550113d1f2 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Fri, 19 May 2023 16:54:32 +0300 Subject: [PATCH] Preferences: Resync menulists when their subtrees change --- chrome/content/zotero/preferences/preferences.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/chrome/content/zotero/preferences/preferences.js b/chrome/content/zotero/preferences/preferences.js index 2eb9fa29a8..4a2cfcd23b 100644 --- a/chrome/content/zotero/preferences/preferences.js +++ b/chrome/content/zotero/preferences/preferences.js @@ -345,6 +345,17 @@ ${str} true ); this._observerSymbols.set(elem, symbol); + + if (elem.tagName === 'menulist') { + // Set up an observer to resync if this menulist has items added/removed later + // (If we set elem.value before the corresponding item is added, the label won't be updated when it + // does get added, unless we do this) + new MutationObserver(() => syncFromPref(elem, preference)) + .observe(elem, { + childList: true, + subtree: true + }); + } }; let detachFromPreference = (elem) => {