feat(modals): DOMContentLoaded bootstrap reopens modal from ?modal= URL

Refresh and share-link flows both work — the modal-state URL is the
canonical shareable artifact for "this overlay with this file open."

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
mwiegand 2026-05-17 12:36:04 +02:00
parent 6e66375233
commit afd2ed1c3c
No known key found for this signature in database

View file

@ -69,6 +69,13 @@
dlg.addEventListener("click", (event) => { dlg.addEventListener("click", (event) => {
if (event.target === dlg) dlg.close(); if (event.target === dlg) dlg.close();
}); });
// Bootstrap: if the page loaded with ?modal=<path> already in the URL
// (refresh, share-link, or browser-history forward), open that modal.
const initialPath = new URL(window.location.href).searchParams.get("modal");
if (initialPath) {
fetchAndShow(initialPath);
}
}); });
// Browser back/forward: re-evaluate URL state and either fetch+show a new // Browser back/forward: re-evaluate URL state and either fetch+show a new