Skip to content

Fix: give the save toast a coloured fill that meets WCAG AA - #6

Merged
SandObserver merged 2 commits into
mainfrom
fix/toast-contrast
Aug 9, 2026
Merged

SandObserver merged 2 commits into
mainfrom
fix/toast-contrast

Conversation

@SandObserver

Copy link
Copy Markdown
Owner

Summary

  • Replace the toast's border-inline-start: 3px solid accent with a filled background: color-mix(in srgb, var(--gn) 30%, var(--bg-outer)) for success and the same with var(--rd) for failure, with the raw accent on border-color.
  • Measured: text on the fill is 8.13 (ok) and 10.33 (err) against the 4.5 of WCAG 1.4.3; the border is 8.42 and 4.96 against the page, against the 3.0 of 1.4.11. Under prefers-contrast: more the palette swaps to --sy-green-hi/--sy-red-hi and every figure rises. The raw accent as a fill was 2.02 and 3.43 behind the same text and would have failed.
  • Extend ui/test/contrast.test.mjs to parse the mix out of admin.css and compute both thresholds in both palettes, rather than recording numbers in a comment.
  • Rewrite the RTL assertion for the toast: with a full border and no one-sided bar there is no leading edge to place, so the test now asserts neither state rule names a side.
  • role="status" aria-live="polite" on the element is untouched.

Testing
All green. Added 3 tests and rewrote 1; mutation-checked by reverting the fill to the raw accent and by weakening the border, each of which fails the new assertions.

Checklist

  • Stays within the project constraints: one container, no runtime dependencies, no build step (see CONTRIBUTING.md).
  • Tests added or updated for new logic, and the full suite, lint, and typechecks pass.
  • Docs updated if behavior or configuration changed.
  • CHANGELOG.md updated under Unreleased if the change is user-visible.

Success and failure were carried by a 3px bar on one edge of an otherwise
neutral toast. The state now fills the whole toast, tinted 30% of the accent
into the page colour so near-white text measures 8.13 on success and 10.33 on
failure, where the raw accent behind that text measures 2.02 and 3.43 and fails
1.4.3. The accent stays at full strength on the border, which carries the 3.0 of
1.4.11 on its own at 8.42 and 4.96 against the page.

contrast.test.mjs now reads the recipe out of the stylesheet and computes both
figures in the default and increased-contrast palettes, so a colour change
re-measures instead of drifting from a comment.
@SandObserver SandObserver added the ui/ux UI, UX, and accessibility only fix label Aug 9, 2026
@SandObserver
SandObserver merged commit 383b75a into main Aug 9, 2026
4 checks passed
@SandObserver
SandObserver deleted the fix/toast-contrast branch August 9, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui/ux UI, UX, and accessibility only fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant