Skip to content

fix(app): chart labels reach contrast, every chart speaks the page's language and is purged, and the widget's theme stays its own (GH-3618, GH-3619, GH-3625) - #3641

Merged
gutzbenj merged 2 commits into
mainfrom
fix/app-chart-contrast-locale-widget-3618
Oct 30, 2026
Merged

gutzbenj merged 2 commits into
mainfrom
fix/app-chart-contrast-locale-widget-3618

Conversation

@gutzbenj

@gutzbenj gutzbenj commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

What changed

GH-3618, contrast. The text that names a series is the series' hue at 4.5:1 or more on the paper, from one table (SERIES_LABEL, seriesLabelColor in utils/chart-theme.ts): the Forecast's y-axis titles and tick labels, its weekend day labels, and the stripes' "data availability" label. The lines, bars and the availability line keep their data colours. Light paper (white) / dark paper (slate-900, #0f172b):

Series Before (light) Label light Label dark
wind, cyan #06b6d4 2.4:1 #0e7490 5.4:1 #06b6d4 7.34:1
precipitation, blue #3b82f6 3.7:1 #2563eb 5.2:1 #3b82f6 4.85:1
temperature and weekend, red #ef4444 3.8:1 #dc2626 4.8:1 #ef4444 4.74:1
pressure, lime #84cc16 2.0:1 #4d7c0f 5.0:1 #84cc16 9.03:1
availability, gold goldenrod 2.2:1 #b45309 5.0:1 #daa520 7.97:1

The Forecast's zero line is the muted text colour (it was a 20 % wash, 1.4:1 / 1.7:1). tests/e2e/chart-theme.spec.ts now reads the drawn charts (title and tick colour of every y axis, the zero line, the weekend labels, the stripes' label, in both schemes, washes mixed over the paper) and holds them to 4.5:1 / 3:1.

GH-3619, widget scheme and purge. widget.vue forces its scheme (colorMode.forced, the mechanism of definePageMeta({ colorMode })) instead of setting preference, which @nuxtjs/color-mode saves to localStorage for the whole origin. The saved choice stays, and the next navigation puts the app's scheme back. The Explorer (single chart and facets) and the stripes purge their charts before unmount, and the Explorer also purges a chart whose element goes while the viewer stays (table view, facets on or off, an answer of other parameters). The Meteogram's purge never ran: chartRef is already cleared in onUnmounted, so it is onBeforeUnmount now.

GH-3625, language. One helper, utils/plotly-locale.ts, gives every chart config locale and locales: Plotly's own button names (new dependency plotly.js-locales, one chunk per language, loaded on use) and the Intl names of weekdays and months. lb and de-hh take German's buttons; the camera the app adds itself is translated too (Plotly does not translate an added button). The stripes await the language before they purge and draw, so an older drawing whose chunk comes late draws nothing and the chart is not blank meanwhile; a language whose chunk failed is drawn in English and asked for again by the next drawing (not kept in the Explorer's config); the copy drawn for a saved image (Explorer and stripes) has the page's locale; Polish and Danish, whose Plotly dictionary is empty, load no chunk. A language switch redraws the charts like a scheme switch (Meteogram and stripes already watched locale; the Explorer's single chart and facets follow through the config). The suncalc caching of the issue was done by #3615. Plotly ships no button names for Polish and Danish and only some for Dutch: those stay English, as noted in ACCESSIBILITY.md.

Tests

  • vitest: purge on unmount (Explorer single and facets, stripes, Meteogram), the widget scheme and the saved preference, the locale in each chart's config and after a switch, the label colours; unit tests for the helper and the contrast of every label colour; a real-Plotly test that the modebar's button names follow the config, also through react.
  • e2e (chart-theme.spec.ts, Chrome, production build): contrast of the Forecast and the stripes' label, and the widget with ?theme=dark over a saved light scheme and the reverse, read from localStorage and from the app opened afterwards.
  • Each fix was reverted in turn and its tests failed.

Closes #3618
Closes #3619
Closes #3625

🤖 Generated with Claude Code

https://claude.ai/code/session_0187kUCUFKYgEkY8mDbH23V8

gutzbenj and others added 2 commits October 30, 2026 20:48
…language and is purged, and the widget's theme stays its own (GH-3618, GH-3619, GH-3625)

The text that names a series (the Forecast's y-axis titles and tick labels, its weekend day
labels, the stripes' availability label) is the series' hue at 4.5:1 or more on the paper, and
the Forecast's zero line is the muted text colour. The widget's ?theme= is forced on the page, not
set as the preference the colour-mode module saves to localStorage for the whole origin. The
Explorer and the stripes purge their charts before they unmount, as does the Meteogram, whose
onUnmounted found its chart ref already cleared. Every chart config carries the page's language
through one helper (plotly.js-locales for the buttons, Intl for the dates).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0187kUCUFKYgEkY8mDbH23V8
…, GH-3619, GH-3625)

- stripes: the language is awaited before the purge and the drawing, and an older drawing whose
  chunk comes late draws nothing; the chart is not blank while the chunk loads
- saved images: the copy drawn off screen gets the page's locale (Explorer and stripes)
- Explorer: a failed language chunk is not kept as the language's config, so the next drawing asks again
- Explorer: a chart whose element goes while the viewer stays (table view, facets on and off, an
  answer of other parameters) is purged
- Polish and Danish, whose Plotly dictionary is empty, load no chunk
- the dark paper is slate-900 (#0f172b): the contrast test and ACCESSIBILITY.md say so

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0187kUCUFKYgEkY8mDbH23V8
@gutzbenj
gutzbenj merged commit 071235c into main Oct 30, 2026
18 checks passed
@gutzbenj
gutzbenj deleted the fix/app-chart-contrast-locale-widget-3618 branch October 30, 2026 20:19
gutzbenj added a commit that referenced this pull request Nov 10, 2026
…ames its reasons (Closes #3642, Closes #2559) (#3949)

Closes #3642. Closes #2559 (the maintainer's decision of 2026-11-10: one app PR for the Meteogram's contrast, the baseline's issue links and reasons, and the acceptance written down).

## Colours (#3642)

The Meteogram's HTML chrome outside Plotly used Tailwind's 500 shades. The icons of the five panel toggles and of the summary line now take the label colours of the charts (`SERIES_LABEL` / `seriesLabelColor`, #3641; `slate` is new, for the cloud cover, which has no label). A toggle that is on is the icon in that colour on a 10 % wash and a 40 % edge of it (`panelToggleStyle`), so the colour is one source for the icon, the wash and the edge.

| Mark | Before (white, v4 palette) | After, by day: white / toolbar / on a toggle that is on | After, at night: card / toolbar / on a toggle that is on |
| --- | --- | --- | --- |
| wind (cyan) | `cyan-500` 2.37 | `#0e7490` 5.36 / 5.10 / 4.47 | `#06b6d4` 6.47 / 6.23 / 5.29 |
| pressure (lime) | `lime-500` 1.95; toggle on `lime-600` 2.74 | `#4d7c0f` 4.99 / 4.75 / 4.20 | `#84cc16` 7.95 / 7.66 / 6.33 |
| cloud cover (slate) | `slate-400` 2.63 | `#475569` 7.58 / 7.21 / 6.23 | `#94a3b8` 6.12 / 5.90 / 4.96 |
| temperature (red) | `red-500` 3.81 | `#dc2626` 4.83 / 4.60 / 3.95 | `#f25b5b` 4.80 / 4.63 / 4.18 |
| rain (blue) | `blue-500` 3.76 | `#2563eb` 5.17 / 4.92 / 4.29 | `#5b9cf8` 5.65 / 5.44 / 4.63 |

Other HTML uses of the series colours found by grepping the whole app:
- The wind line's `(km/h)` text (`text-cyan-700 dark:text-cyan-400`) takes the cyan label colour too (5.36 / 6.47).
- The card of today had `border-blue-400 dark:border-blue-800` (2.5:1 by day); it is `border-blue-600 dark:border-blue-400` (5.25 and 5.95).
- The explorer's warning icon was `text-red-500` (3.81); it is `text-red-600 dark:text-red-400`.
- A toggle also says whether it is on (`aria-pressed`, it had none); the inactive toggles keep the app's greys (held at 3:1).

## Baseline entries (#2559)

Each entry in `tests/e2e/accessibility/baseline.json` has an `issue` and a `reason`. I reproduced all four against the current components (Chrome 156, the spec's states, the generated markup read). In each the app sets none of the attributes concerned and has no prop or slot that reaches them: the cause is Nuxt UI's or Reka UI's. The upstream trackers were read only; **no issue was opened**.

| Entry | Cause | Issue |
| --- | --- | --- |
| `aria-required-children`, explorer and meteogram / `station-menu-open` | Nuxt UI `USelectMenu`: `role="listbox"` on the combobox content, whose only child is `<div tabindex="-1" data-slot="focusScope">` | nuxt/ui#7075 (closed; fixed by nuxt/ui#7096 in 4.12.0) |
| `scrollable-region-focusable`, explorer / `station-menu-open` | The same menu's `role="presentation"` viewport scrolls, with options at `tabindex="-1"` | the same issue, #7075 |
| `aria-hidden-focus`, explorer / `values-error` | Reka UI toast viewport (behind `UToaster`): two focus proxies `<span aria-hidden="true" tabindex="0">` | unovue/reka-ui#2776 (closed; fixed by unovue/reka-ui#2980 in 2.11.0) |

**All three are fixed in releases the app does not have yet.** The app is on `@nuxt/ui` 4.11.3 and `reka-ui` 2.10.5; `@nuxt/ui` 4.12.0 (2026-10-15) depends on `reka-ui` 2.11.0 (2026-10-05). In a throwaway copy of the app (not committed) built on 4.12.0, the three states reproduce none of the rules. Bumping `@nuxt/ui` would therefore empty the baseline. I did not bump: it is a dependency change of its own (4.12.0 also loads the menu and toast overlays lazily), and it is not in the decision.

Schema: `issue?: string | null` and `reason?: string` are optional, so the spec (`compareToBaseline`) is unchanged and old files still load. `report.mjs --write-baseline` keeps both for an entry that is still found. `tests/unit/a11y-baseline.test.ts` holds that every entry states a reason and an issue (a GitHub URL or `null`, and a `null` names its project in the reason).

## `app/ACCESSIBILITY.md`

- New section "How it is accepted", as decided: axe on request (`pnpm test:a11y`, the *App accessibility* workflow by dispatch or the label), not in every e2e run, because of its run time; Lighthouse by hand before each app release, with its score recorded in the file; the baseline lists its causes.
- The baseline section lists the entries with their cause and issue (table above).
- Lighthouse section: a table (date, app version, Lighthouse version, pages x devices, scores), with the 2026-10-18 result (Lighthouse 13.5.0, 34 x 100) and a row for this run, and how a row is made.
- A paragraph on the Meteogram's chrome in the contrast section; the "On request" section states the scan's size and time, and the result of the full run below.

## Lighthouse (run by hand, this change)

Lighthouse 13.6.0, Chrome 156.0.8078.80, production build of this tree with the spec's mock answers served as the backend, 17 URLs x mobile and desktop = 34 runs: **34 x 100**. A first run of the same pages scored the widget 98 (`landmark-one-main`: the page has no main landmark); the widget now has a `<main>` around its content (a unit test holds it).

## Tests, mutation checks and results

- `tests/unit/button-contrast.test.ts` (new `describe`): every `SERIES_LABEL` colour on white, the paper, the toolbar and the dark card at 4.5:1; as the icon of a toggle that is on, on its own wash, at 3:1; the Tailwind palette read from `tailwindcss/theme.css` (oklch to sRGB, red-600 checked at 4.77); every `text-<colour>-<step>` class in `app/**/*.vue|ts` at 4.5:1 on white (`dark:` on the dark card); the Meteogram has no `text-(cyan|lime|slate)-` class and uses the label colours; the today card's border at 3:1.
- `tests/e2e/chart-theme.spec.ts`: the icons and toggles measured as the browser paints them (computed colour of the icon, every background under it down to the page), on, off, and in both schemes.
- Mutation checks, each failing and restored: cyan light label put back to `#06b6d4` (5 unit tests fail); `text-lime-500` back on an icon (2 fail); `text-slate-400` back (2 fail); `text-red-500` back on the explorer icon (1 fails); `border-blue-400 dark:border-blue-800` back on the card (1 fails); lime light label to `#84cc16` in the e2e (fails: `pressure toggle that is on, rgb(132, 204, 22) on rgb(237, 245, 227)`); the widget's `<main>` back to a `<div>` (1 fails).
- `pnpm lint`: clean. `pnpm typecheck` (tsbuildinfo deleted first): exit 0. `pnpm test:ci`: **103 files, 2990 tests passed**. E2E (Chrome, Playwright's Firefox does not start on this machine): `chart-theme.spec.ts` and `meteogram-barbs.spec.ts`, **27 passed**.
- `pnpm test:a11y --workers=3` on this tree (Chrome 156, axe 4.13.0): **393 tests, 393 passed, none retried, 15.5 minutes**; it found exactly the four baseline entries. A first run failed six tests of `index: search-results`: the spec expected one option for BERLIN-TEMPELHOF where the search lists the station twice (forecast, and on the map since #3839), which nothing had noticed as the scan runs on request. The spec takes the first now. (A second full run was disturbed by an e2e run of mine on the same server and is not counted.) The scan has been run in Chrome; the baseline was recorded in Firefox on Linux, which the `a11y` label would run in CI. I did not set it.

## Review fixes (commit 6115bed, a merge of main, and 68eb412)

- **M1, a valid class crashed the contrast file.** Tailwind 4.3.3 writes `oklch(55.6% 0 none)` for every `neutral-*` and `zinc-50` (13 colours). `oklchToHex` takes `none` as 0 and throws a named error (`not an oklch() colour of Tailwind's palette: ...`) instead of `!`. New tests: `neutral-500` converts, at 4.74:1 on white; every `--color-*: oklch(...)` of `theme.css` (200+) converts; an unreadable colour is a named error. Mutation: the old numeric-only hue back fails the two neutral tests with the named error; a `text-neutral-500 dark:text-neutral-300` class in the markup passes (does not crash), and without its partner it is flagged (3.31:1 on the dark card).
- **L1, gaps in the text-colour test.** A light class with no `dark:` partner in its class string (a partner is any `dark:` text colour of the same variants, `dark:text-white` included; the string is what lies between two quotes) is now also held to the dark card. That found `pages/history.vue`: `text-red-600` error text at 3.29:1 at night, now `dark:text-red-400` (mutation: the old class back fails with `pages/history.vue: text-red-600 (no dark: partner, painted at night too) 3.29:1 on card`). An opacity (`/NN`) or arbitrary `text-[#hex]` now fails (`unreadable`) rather than being skipped; none exists in the app today. `primary` and `brand` are **not** resolved: `text-primary-500` is 3.47:1 on white and is used **48 times** (icons and spinners), so resolving them would fail 48 places. I took the allowed alternative and said so in the test and in ACCESSIBILITY.md: only Tailwind's palette and `gray` are checked. The 48 `text-primary-500` uses are a finding for its own issue, not fixed here. The scan has tests of its own (what it flags and lets through).
- **L2.** The test that could not fail is general: an entry with `issue: null` must name an owner (`Nuxt UI`, `Reka UI`, `Leaflet`, `Plotly`, `Tailwind`, `the app`) in its reason, and a synthetic test shows the check can say no.
- **L3.** `pnpm lighthouse` (`app/tests/e2e/accessibility/lighthouse.mjs`) starts the spec's mock backend (the TypeScript file, transpiled with the `typescript` the app already has) as a plain HTTP server, serves `.output` with `NUXT_API_BASE` on it, runs `npx lighthouse@<version>` over the 17 URLs on mobile and desktop, prints each score with the failed audits and the line for the table, and exits 1 under 100. `tests/unit/lighthouse-urls.test.ts` holds its URLs to the spec's `PAGES`. ACCESSIBILITY.md's by-hand step now says `pnpm build && pnpm lighthouse`. I ran it end to end: **17 URLs x mobile and desktop, 34 x 100** (Lighthouse 13.6.0, HeadlessChrome 157; Chrome had updated since the first run). The first version of the script hung the API page: `spawnSync` blocked the script's own mock backend while Lighthouse waited for `/api/version` (NO_FCP). That is fixed in 68eb412 (async spawn, one retry of a run Lighthouse fails itself, `--only` for a subset of the URLs).
- **Nits.** `CHANGELOG_APP.md`: the Forecast entry is rewrapped to 100 columns and mentions the night edge of today's card (blue-800 1.8:1 to blue-400 6.0:1; the day edge was 2.6:1 before, not 2.5), the explorer icon has its own `[Explorer]` line, and the History error text has a `[History]` line. ACCESSIBILITY.md: line 3 no longer calls #2559 the open tracking issue; "500 shades" names what the toggles and icons had (cyan-500, lime-500, red-500, blue-500, slate-400); the last-run paragraph says the first run came before the `.first()` fix and mentions the second, disturbed run, and that the app change since the full run is the `dark:` colour on History's error. `tests/nuxt/components/Meteogram.test.ts` has a describe that holds `aria-pressed`, the toggles' style, the summary icons' colours in both schemes and today's card classes in the rendered component (mutation: `aria-pressed` removed and the old card border back fail 3 of the 4); the source-text assertions in `button-contrast.test.ts` are gone. The comment in `playwright.config.ts` states the scan's real size.
- **Checks** (`app/`, after merging main, which changed no app file): `pnpm lint` clean; `pnpm typecheck` (tsbuildinfo deleted) exit 0; `pnpm test:ci` **104 files, 3004 tests passed**; `chart-theme.spec.ts` e2e (Chrome, port 4415) **25 passed**. The full a11y scan was not re-run: the app change since the recorded run is the `dark:` class on History's error text (ACCESSIBILITY.md says so).

Review fixes: the contrast test reads Tailwind's `none` hue instead of crashing, holds a light text colour with no `dark:` partner to the dark card (History's error text fixed), and fails on opacity modifiers and arbitrary colours; `pnpm lighthouse` committed for the by-hand runs (34 of 34 at 100); the baseline test can fail; `aria-pressed` held in the component test. The App accessibility workflow was dispatched once on the head and passed. The `primary`/`brand` text colours the test does not check are a separate issue.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0187kUCUFKYgEkY8mDbH23V8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant