mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Fix repertoire column scrolling + admin TOC duplication
- repertoire.css: add min-height: 0 to column <ul> scroll containers so grid 1fr row shrinks below content and overflow-y: auto activates - admin-toc.js: add __adminTocBuilt guard + nav.children check to prevent double population when loaded both via admin.min.js and direct <script> - admin-toc.php: remove duplicate <script src="admin-toc.js"> tag — JS is already bundled in admin.min.js
This commit is contained in:
@@ -73,6 +73,7 @@
|
||||
grid-row: 2;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
min-height: 0;
|
||||
padding-top: var(--space-2xs);
|
||||
padding-bottom: var(--space-l);
|
||||
padding-left: 0;
|
||||
|
||||
@@ -4,14 +4,22 @@
|
||||
*
|
||||
* Renders nav links from section[aria-labelledby] headings inside #main-content.
|
||||
* Hides the TOC aside if fewer than 2 sections exist.
|
||||
*
|
||||
* Guarded: only runs once even if loaded multiple times (e.g. via bundle + direct <script>).
|
||||
*/
|
||||
(function () {
|
||||
if (window.__adminTocBuilt) return;
|
||||
window.__adminTocBuilt = true;
|
||||
|
||||
function build() {
|
||||
var main = document.getElementById('main-content');
|
||||
var nav = document.getElementById('admin-toc-list');
|
||||
var aside = document.getElementById('admin-toc');
|
||||
if (!main || !nav || !aside) return;
|
||||
|
||||
// Guard against double population (nav already has children from a prior run)
|
||||
if (nav.children.length > 0) return;
|
||||
|
||||
var sections = main.querySelectorAll('section[aria-labelledby]');
|
||||
if (sections.length < 2) {
|
||||
aside.hidden = true;
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
?>
|
||||
<aside id="admin-toc" class="admin-toc" aria-label="Sur cette page">
|
||||
<nav class="admin-toc-list" id="admin-toc-list">
|
||||
<!-- populated by JS -->
|
||||
<!-- populated by JS (admin-toc.js, loaded via admin.min.js) -->
|
||||
</nav>
|
||||
</aside>
|
||||
|
||||
<script src="<?= App::assetV('/assets/js/app/admin-toc.js') ?>"></script>
|
||||
|
||||
Reference in New Issue
Block a user