From 64ccc0ba841f5860ad4d16c98c18de00448445d4 Mon Sep 17 00:00:00 2001 From: MechaCat02 Date: Sun, 17 May 2026 20:47:32 +0200 Subject: [PATCH] bugfix: measure bar heights with ResizeObserver instead of magic numbers (0.21.2) --- backend/Cargo.lock | 2 +- backend/Cargo.toml | 2 +- frontend/package.json | 2 +- frontend/src/routes/+layout.svelte | 23 ++++++++++++- .../manga/[id]/chapter/[n]/+page.svelte | 33 ++++++++++++++++++- 5 files changed, 57 insertions(+), 5 deletions(-) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 40ce7aa..e844c03 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -1033,7 +1033,7 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "mangalord" -version = "0.21.1" +version = "0.21.2" dependencies = [ "anyhow", "argon2", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index d893a5a..7bb978c 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mangalord" -version = "0.21.1" +version = "0.21.2" edition = "2021" [lib] diff --git a/frontend/package.json b/frontend/package.json index c69faa6..164feb5 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "mangalord-frontend", - "version": "0.21.1", + "version": "0.21.2", "private": true, "type": "module", "scripts": { diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte index 296441a..dba595e 100644 --- a/frontend/src/routes/+layout.svelte +++ b/frontend/src/routes/+layout.svelte @@ -14,11 +14,32 @@ let { children } = $props(); let loggingOut = $state(false); + let headerEl: HTMLElement | undefined = $state(); onMount(() => { theme.init(); preferences.init(); if (!session.loaded) session.refresh(); + + // Publish the header's measured height as a CSS custom + // property so sticky descendants (e.g. the reader nav) can + // pin themselves directly below it without guessing. A + // ResizeObserver keeps it in sync as the viewport reflows + // (the nav `flex-wrap: wrap`s on narrow widths), the user + // zooms, or fonts swap. Hard-coded pixel offsets in tokens + // are wrong in principle — actual height varies with all + // of the above. + if (!headerEl) return; + const publish = () => { + document.documentElement.style.setProperty( + '--app-header-h', + `${headerEl!.offsetHeight}px` + ); + }; + publish(); + const ro = new ResizeObserver(publish); + ro.observe(headerEl); + return () => ro.disconnect(); }); // Pull fresh server preferences whenever the user changes (login, @@ -46,7 +67,7 @@ } -
+