fix(insights): eliminate layout shift on the Today's-signal card

The dynamic loader skeleton reserved 120px while the resolved card's
insufficient (~168px) and fired (~192px) states ran taller, shifting the hero
and everything below it down 48–72px on resolve. Pin a min-h-48 on the card
shell sized to the tallest realistic state, and match both the chunk-loader
skeleton and the in-component CardSkeleton to that footprint (including the
44px provenance header row) so there is zero shift across loading → any state.
Announce the fired state to screen readers via a polite role=status (not the
assertive role=alert), and mark the decorative loader skeleton aria-hidden.
This commit is contained in:
Marc-André Bombeck committed 2026-06-03 20:07:46 +02:00
1 parent 17ad93ca5d
commit 1e469d8185
3 files changed
+58 -10

No files matched your search

+8 -4
View File
@@ -100,9 +100,10 @@ const RhythmEventsCard = dynamic(
// v1.10.3 — "Today's signal" headline card. Promotes COINCIDENT_DEVIATION from
// a buried below-the-fold tile to the top-of-overview daily read (the
// always-present Apple/WHOOP/Oura pattern). Deferred behind `next/dynamic`; it
// owns its own derived-metric query and renders four calm states. A
// fixed-height skeleton matches the resolved card so the top of the page does
// not shift while the chunk + data resolve.
// owns its own derived-metric query and renders four calm states. The chunk
// loader's skeleton shares the card's `min-h-48` footprint (and the in-card
// `CardSkeleton` matches it too) so the top of the page does not shift across
// loading → any resolved state. Decorative → `aria-hidden`.
const CoincidentDeviationCard = dynamic(
() =>
import("@/components/insights/coincident-deviation-card").then((mod) => ({
@@ -111,7 +112,10 @@ const CoincidentDeviationCard = dynamic(
{
ssr: false,
loading: () => (
<div className="bg-card border-border h-[7.5rem] animate-pulse rounded-xl border motion-reduce:animate-none" />
<div
aria-hidden="true"
className="bg-card border-border min-h-48 animate-pulse rounded-xl border motion-reduce:animate-none"
/>
),
},
);