Zotero 9.0.x: ItemPane custom-section icons missing (TypeError in itemPaneSection.js setL10nID)
Bug description
In Zotero 9.0.4 / 9.0.5 / 9.0.6, plugin-provided sections in the main
window ItemPane are rendered by calling setL10nID() / setL10nArgs()
during element initialization, before the element is upgraded —
this._section is still undefined. The base class then throws:
TypeError: can't access property "dataset", this._section is undefined
setL10nID chrome://zotero/content/elements/itemPaneSection.js:288The exception propagates out of renderCustomSections() (itemDetails.js)
and aborts section registration, so the plugin's ItemPane sidebar icon is
silently missing. Reproduced with llm-for-zotero 3.8.31 on Zotero 9.0.6
(Windows 11): the "LLM Assistant" icon never appears in the main-window
ItemPane sidebar, while the plugin itself loads fine (the standalone
Ctrl+Shift+L window works).
This looks like a regression from the 9.0 refactor of itemPaneSection.js
— pre-9.0 the setters only touched DOM properties.
Steps to reproduce
- Install Zotero 9.0.6 and any plugin that registers an ItemPane section (e.g. llm-for-zotero 3.8.31).
- Open the main window and select an item.
- The plugin's icon is missing from the ItemPane sidebar.
- Check the error console: the TypeError above is logged once per section registration.
Expected behavior
Plugin ItemPane icons render as in Zotero 7/8.
Proposed fix
Cache the l10n values when not initialized, exactly like the existing
registerSectionIcon() method does; init() already replays both cached
values after upgrade:
setL10nID(l10nId) {
+ if (!this.initialized) {
+ this._sectionL10nId = l10nId;
+ return;
+ }
this._section.dataset.l10nId = l10nId;
this._sectionL10nId = l10nId;
}
setL10nArgs(l10nArgs) {
+ if (!this.initialized) {
+ this._sectionL10nArgs = l10nArgs;
+ return;
+ }
this._section.dataset.l10nArgs = l10nArgs;
this._sectionL10nArgs = l10nArgs;
}This patch is verified working on 9.0.6 (icons + LLM chat panel functional afterwards); one-click script and full repro at https://github.com/kebogan/zotero-item-pane-patch
Environment
- Zotero 9.0.6 (also confirmed present in 9.0.4 / 9.0.5 sources)
- Windows 11
- llm-for-zotero 3.8.31 (any section-registering plugin is affected)
Source: zotero/zotero