This commit is contained in:
Mi Ramon 2026-08-27 22:39:05 +02:00 committed by GitHub
commit b8a97bc986
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -357,7 +357,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)) {
child.after(elem);
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);