mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
test(a11y): gate the metric scans on the chart's own slot
The two metric sub-page cases waited for `.recharts-wrapper`, a class the charting library writes and every chart on the page carries, so the gate was satisfied by whichever chart rendered first rather than by the one the route exists to show. On `/insights/mood` that is exactly what happened: the mock carried a single mood entry on a fixed date, the chart withholds its line below three distinct days, and the sparse placeholder painted while some other chart answered the gate. The mood line was never waited for and may never have been scanned. Both charts now carry `data-slot="chart-plot"` on the wrapper their data branch renders — an empty window still paints the empty state and the scan still waits — and the mood fixture is anchored on now with ten daily scores, the same way the measurement rows above it are.
This commit is contained in:
1 parent
1d372df3a0
commit
cee6c70638
3 files changed
+38
-11
No files matched your search
@@ -1945,6 +1945,11 @@ export function HealthChart({
|
||||
) : null}
|
||||
|
||||
<div
|
||||
// Stable hook for the browser suite. `.recharts-wrapper` is a
|
||||
// library-internal class and it is what the a11y scan used to
|
||||
// gate on; this slot is rendered by the data branch only, so it
|
||||
// says the same thing without depending on Recharts' markup.
|
||||
data-slot="chart-plot"
|
||||
className="relative z-10 h-full touch-pan-y"
|
||||
role="img"
|
||||
aria-label={chartAriaLabel}
|
||||
|
||||
@@ -767,6 +767,10 @@ export function MoodChart({
|
||||
? "h-[var(--chart-height,140px)]"
|
||||
: "h-[var(--chart-height,200px)] md:h-[var(--chart-height-md,220px)]"
|
||||
} touch-pan-y`}
|
||||
// Same stable hook as the measurement chart: rendered by the data
|
||||
// branch only, so the browser suite can gate on it instead of on
|
||||
// Recharts' own class names.
|
||||
data-slot="chart-plot"
|
||||
role="img"
|
||||
aria-label={moodAriaLabel}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user