From afd2ed1c3c830056f5e3b49d1608a57cf657a2bc Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sun, 17 May 2026 12:36:04 +0200 Subject: [PATCH] feat(modals): DOMContentLoaded bootstrap reopens modal from ?modal= URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- l4d2web/l4d2web/static/js/modal-router.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/l4d2web/l4d2web/static/js/modal-router.js b/l4d2web/l4d2web/static/js/modal-router.js index 04a00e7..3107408 100644 --- a/l4d2web/l4d2web/static/js/modal-router.js +++ b/l4d2web/l4d2web/static/js/modal-router.js @@ -69,6 +69,13 @@ dlg.addEventListener("click", (event) => { if (event.target === dlg) dlg.close(); }); + + // Bootstrap: if the page loaded with ?modal= 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