Force field to top of item pane

27 views
Skip to first unread message

Emiliano Heyns

unread,
Mar 11, 2026, 7:56:57 AM (3 days ago) Mar 11
to zotero-dev
Is there a robust way that BBT can force the citation key field to the top of the item pane? I tried fiddling with CSS but did not find anything that works. UI is really not my AoE (or AoI really), but I get regular requests to "restore: the key to the top position.

XY Wong

unread,
Mar 11, 2026, 9:03:06 AM (3 days ago) Mar 11
to zotero-dev
You can decide where to add your custom field row: https://github.com/zotero/zotero/blob/be1373dd3a40313916fe26b45326d7b763703f1b/chrome/content/zotero/xpcom/pluginAPI/itemPaneManager.js#L317

And then use CSS to hide the one provided by Zotero, as a workaround.

Emiliano Heyns

unread,
Mar 11, 2026, 11:23:23 AM (3 days ago) Mar 11
to zotero-dev
How do I use CSS to hide the zotero field though? I have tried this:

const doc = Zotero.
getMain
Window
().document
const
style =
doc.
createElement
('style')
style.id = 'bbt-hide-citationkey'
style.textContent = `
.zotero-item-pane-info-row[data-field="citationKey"] {
display: none !important;
}
`
doc.head.
appendChild
(style)

but the doc does not have a head

XY Wong

unread,
Mar 11, 2026, 11:28:13 AM (3 days ago) Mar 11
to zotero-dev
That's because Zotero's main window is not a standard HTML window. Use `document.documentElement.append(...)`

Emiliano Heyns

unread,
Mar 11, 2026, 12:03:51 PM (3 days ago) Mar 11
to zotero-dev
I'm making a note here: HUGE SUCCESS.

Emiliano Heyns

unread,
Mar 11, 2026, 12:08:41 PM (3 days ago) Mar 11
to zotero-dev
When I register a custom field using

Zotero.ItemPaneManager.
registerInfoRow
({
rowID: 'better-bibtex-citation-key',
pluginID,
label: { l10nID: 'better-bibtex_item-pane_info_citation-key_label' },
position: 'start',
multiline: false,
nowrap: false,
editable: false,
onGetData
({ item }) {
return item.
getField
('citationKey')
},
})

Can I set l10nargs for the label? And should the l10nID point to a toplevel ftl entity, or a .label?

XY Wong

unread,
Mar 11, 2026, 12:25:57 PM (3 days ago) Mar 11
to zotero-dev
it will be the direct value of the ftl key (toplevel ftl entity).

For now, we don't support l10nArgs nor dynamically setting/changing them, as it was assumed that for the same field, its label never changes. Do you have a special use case?

Emiliano Heyns

unread,
Mar 11, 2026, 12:38:34 PM (3 days ago) Mar 11
to zotero-dev
Yes -- BBT supports dynamic key reassignment which you can disable per item, and I want to display this status.

I am also trying to work out a way to do citation keys for read-only items that have no key; generating them isn't hard (most parts in place), but it might be possible to get the citation key editable (for local, non-DB save) for read-only items that have no citation key. I would want to have that status visible.

But it's mostly flourish. Nothing critical.

XY Wong

unread,
Mar 11, 2026, 12:45:09 PM (3 days ago) Mar 11
to zotero-dev
Hmm. We can allow l10nArg and dynamically set it in the coming versions.

Emiliano Heyns

unread,
Mar 11, 2026, 4:48:10 PM (3 days ago) Mar 11
to zotero-dev
Can I show/hide the field depending on features of the item (in my case, whether the item actually supports the citationKey field)?

Emiliano Heyns

unread,
Mar 11, 2026, 5:43:20 PM (3 days ago) Mar 11
to zotero-dev
Same for editable really -- I would have to be able to set this depending on whether the item is from a read-only library or not.

Emiliano Heyns

unread,
Mar 12, 2026, 8:16:48 AM (2 days ago) Mar 12
to zotero-dev
or are those setEditable and setEnabled from  
onItemChange? It looks like it.

XY Wong

unread,
Mar 12, 2026, 9:09:28 AM (2 days ago) Mar 12
to zotero-dev
Yes. Those should be available in `onItemChange`
Reply all
Reply to author
Forward
0 new messages