Rework app-shell layout
This commit is contained in:
+6
-11
@@ -187,25 +187,20 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Mobile: a smaller FAB stacked above the menu FAB toggles the rail as an
|
||||
// overlay drawer; selecting any entry closes it (mirrors sidebar-fab.js).
|
||||
// Mobile: the tree FAB sits at the bottom of the stacked FAB group and
|
||||
// opens the rail's content in the full-viewport Overlay (overlay.js). The
|
||||
// rail container always exists when not editing, so — per the layout spec —
|
||||
// the FAB always renders; the overlay auto-closes when a folder/file link
|
||||
// inside it navigates. Hidden on desktop by .fab CSS.
|
||||
function setupFab() {
|
||||
var fab = document.createElement('button');
|
||||
fab.type = 'button';
|
||||
fab.className = 'btn btn-fab fab fab-tree';
|
||||
fab.title = 'Folder tree';
|
||||
fab.setAttribute('aria-label', 'Folder tree');
|
||||
fab.setAttribute('aria-expanded', 'false');
|
||||
fab.innerHTML = '<svg viewBox="0 0 16 16" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="miter"><path d="M1 6h14v8H1zm0 0V4h5l1 2"/></svg>';
|
||||
fab.addEventListener('click', function () {
|
||||
var open = container.classList.toggle('is-open');
|
||||
fab.setAttribute('aria-expanded', open ? 'true' : 'false');
|
||||
});
|
||||
container.addEventListener('click', function (e) {
|
||||
if (e.target.closest('a')) {
|
||||
container.classList.remove('is-open');
|
||||
fab.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
if (typeof openOverlay === 'function') openOverlay(container);
|
||||
});
|
||||
document.body.appendChild(fab);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user