Skip to content

fix(clone): paint accent-color: auto stand-ins in the system accent and draw them closer to the native controls - #561

Merged
tinchox5 merged 4 commits into
zumerlab:mainfrom
Hema2-official:fix/firefox-auto-accent
Nov 14, 2026
Merged

tinchox5 merged 4 commits into
zumerlab:mainfrom
Hema2-official:fix/firefox-auto-accent

Conversation

@Hema2-official

Copy link
Copy Markdown
Contributor

Fixes #560.

The drawn checkbox, radio and slider took the control's text colour for accent-color: auto. On a dark page that is near white, so a checked box came out as a light box under a white tick. This PR paints auto in the UA's own accent, then fixes the other differences from the native controls that showed up while comparing the two.

Changes, by commit

  1. System accent for auto (Firefox: checkbox stand-in uses the text colour for accent-color: auto, so dark pages get a white box with a white tick #560). auto is painted in AccentColor, with AccentColorText for the mark on it.
  2. States the live control shows differently.
    • A disabled control is grey whatever its accent, and dimmed like the disabled slider.
    • A checkbox that is checked and indeterminate shows the dash, not a tick.
    • The tick and dot on an authored accent are white or black by contrast. Firefox 160 switches where white's contrast with the accent falls under 2.4.
    • An unchecked control shows none of its accent.
  3. Shapes closer to the native ones.
    • An indeterminate box is filled, with the dash in the mark colour.
    • An unchecked control is a 1px hairline around the Field colour.
    • The tick grows with the box.
    • A checked radio is Firefox's: the accent to the edge with a ring set in.
    • The stand-in's <svg> now carries the control's colour scheme. The capture's base rule for <svg> resets color-scheme, so system colours in the stand-in resolved as on a light page whatever the page's scheme.
  4. Engine specifics.
    • On a dark page Chromium paints auto controls #99c8ff under a Field-coloured mark, while its AccentColor stays #0075ff. The indeterminate box takes those there.
    • Firefox's slider thumb is grey inside a white rim. Only the run takes the accent.

Target, before, after

Each strip is the same ten controls. Target is a screenshot of the live page, Before is a capture with main (e4a8303), and After is a capture with this branch. Windows 11, with a red system accent.

Firefox 160 (Zen 1.24.1b)

Firefox takes the stand-in for every checkbox, radio and slider.

Dark page
Target Firefox, dark page, live
Before Firefox, dark page, main
After Firefox, dark page, this branch
Light page
Target Firefox, light page, live
Before Firefox, light page, main
After Firefox, light page, this branch

Chrome 157

Chromium keeps its native controls and takes the stand-in only for an indeterminate checkbox, so only the third and fourth controls change. Edge 157 gave the same images as Chrome, byte for byte.

Dark page
Target Chrome, dark page, live
Before Chrome, dark page, main
After Chrome, dark page, this branch
Light page
Target Chrome, light page, live
Before Chrome, light page, main
After Chrome, light page, this branch

Testing

  • npm run check passes.
  • The affected test files pass in Chrome 157: core.clone.more, core.clone.nativeControls, core.clone.indeterminate, snapdom.issue516 and snapdom.issue494.
  • I ran the suite in my installed Chrome only: I have no working Playwright build of Firefox or WebKit here. Firefox was checked by hand, as in the images above. The engine-specific branches have unit tests that stub the user agent.
  • Safari is untested. It takes the stand-in for indeterminate checkboxes and for sliders.

Notes for review

  • colorToRgba in src/modules/styles.js is now exported, for the contrast check.
  • The Several issues occurring only in mobile Firefox #516 centring test looked for red on unchecked radios with a red accent. An unchecked control no longer shows its accent, so the test checks the radios first.
  • #99c8ff is hard-coded for Chromium's dark scheme. Chrome paints AccentColor inside the capture only as the whole value of an attribute, not inside light-dark(), so the scheme is settled when the control is drawn. I measured it in Chrome and Edge on Windows only.
  • Still approximate: a disabled control reads as disabled but is not Firefox's exact grey, the slider thumb is smaller than Firefox's, and Firefox's dark tick on a light accent is a darkened accent where the stand-in uses black.

🤖 Generated with Claude Code

Hema2-official and others added 4 commits November 14, 2026 20:50
…umerlab#560)

The drawn checkbox, radio and slider took the control's text colour for
`accent-color: auto`. On a dark page that is near white, so a checked box
came out light under a white tick. `auto` is the UA's own accent, which
CSS names AccentColor, with AccentColorText for the mark on it. Both
resolve inside the capture to what the page resolves them to.

An unchecked `auto` control keeps the text colour as its outline.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Four states of the drawn checkbox and radio that the live control shows
differently:

- A disabled control is grey whatever its accent.
- A checkbox that is checked and indeterminate shows the dash, not a tick.
- The tick and the dot on an authored accent are white or black by
  contrast.
- An unchecked control shows none of its accent.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
… ones

Measured against Firefox 160 and Chrome 157.

- An indeterminate box is filled like a checked one, with the dash in the
  mark colour.
- An unchecked control is a 1px hairline around the Field colour.
- The tick grows with the box, about an eighth of it thick, and keeps
  clear of the edges.
- A checked radio is Firefox's: the accent to the edge, with a ring of
  the mark colour set in.

The stand-in's svg now carries the control's colour scheme. The capture's
base rule for <svg> resets color-scheme, so the system colours resolved as
on a light page whatever the page's scheme.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Chromium paints `auto` controls #99c8ff on a dark page, not its
AccentColor. Firefox's slider thumb is grey, whatever the accent.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@tinchox5

Copy link
Copy Markdown
Member

Thank you! Merging now!

@tinchox5
tinchox5 merged commit cb14dae into zumerlab:main Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Firefox: checkbox stand-in uses the text colour for accent-color: auto, so dark pages get a white box with a white tick

2 participants