Cap legal dialog size and match mobile navigation colors
showcase/deploy Live at https://showcase.andrefiedler.de/2608_BuB/

This commit is contained in:
André Fiedler
2026-09-10 11:50:18 +02:00
parent 11c51f7975
commit b470cd3302
5 changed files with 26 additions and 6 deletions
+9
View File
@@ -1,8 +1,12 @@
const dialogs = new Map(
[...document.querySelectorAll('.legal-dialog')].map(dialog => [dialog.id, dialog]),
);
const themeColor = document.querySelector('meta[name="theme-color"]');
let returnFocus;
// Native dialogs own visibility; :target is reserved for the no-script fallback.
document.documentElement.classList.add('legal-dialogs-enhanced');
function syncDialog() {
const next = dialogs.get(location.hash.slice(1));
let closed = false;
@@ -23,6 +27,11 @@ function syncDialog() {
returnFocus?.focus({ preventScroll: true });
returnFocus = undefined;
}
// Match the browser navigation area to the canvas surrounding the dialog.
if (themeColor) {
themeColor.content = getComputedStyle(document.documentElement).backgroundColor;
}
}
function dismissDialog() {