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:
parent
6e66375233
commit
afd2ed1c3c
1 changed files with 7 additions and 0 deletions
|
|
@ -69,6 +69,13 @@
|
|||
dlg.addEventListener("click", (event) => {
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue