From a68ec51f8334c40b43595622bab48cc373dc3757 Mon Sep 17 00:00:00 2001 From: Ramon Mi Date: Sat, 2 May 2026 20:33:51 +0800 Subject: [PATCH 1/2] fix: push non-orderable itemDetail sections to the bottom Ensure `orderable: false` sections are consistently rendered last, resolving previous display order inconsistencies. --- chrome/content/zotero/elements/itemDetails.js | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/elements/itemDetails.js b/chrome/content/zotero/elements/itemDetails.js index 2c6ea9c1e5..6157b70438 100644 --- a/chrome/content/zotero/elements/itemDetails.js +++ b/chrome/content/zotero/elements/itemDetails.js @@ -395,7 +395,28 @@ if (this._pendingRender) { elem.pendingRender = true; } - this._paneParent.append(elem); + // If the section to insert is non-orderable, directly append it + if (!this.sidenav.isPaneOrderable(paneID)) { + this._paneParent.append(elem); + } + else { + // Loop from tail to find the first orderable section and insert after it + let children = Array.from(this._paneParent.children); + let inserted = false; + for (let i = children.length - 1; i >= 0; i--) { + let child = children[i]; + let childPaneID = child.dataset.pane; + if (this.sidenav.isPaneOrderable(childPaneID)) { + this._paneParent.insertBefore(elem, child.nextSibling); + inserted = true; + break; + } + } + // If no orderable section found, prepend + if (!inserted) { + this._paneParent.prepend(elem); + } + } elem.setL10nID(header.l10nID); elem.setL10nArgs(header.l10nArgs); this._intersectionOb.observe(elem); From 8e4b8a5ddc2d763cd857542261db34bd8b938774 Mon Sep 17 00:00:00 2001 From: Ramon Mi Date: Wed, 13 May 2026 21:07:38 +0800 Subject: [PATCH 2/2] simplify code --- chrome/content/zotero/elements/itemDetails.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/elements/itemDetails.js b/chrome/content/zotero/elements/itemDetails.js index 6157b70438..2870a22bef 100644 --- a/chrome/content/zotero/elements/itemDetails.js +++ b/chrome/content/zotero/elements/itemDetails.js @@ -407,7 +407,7 @@ let child = children[i]; let childPaneID = child.dataset.pane; if (this.sidenav.isPaneOrderable(childPaneID)) { - this._paneParent.insertBefore(elem, child.nextSibling); + child.after(elem); inserted = true; break; }