Skip to content

test(a11y): check contrast a frame after the page's fades end - #330

Merged
Moltenship merged 1 commit into
mainfrom
fix/a11y-webkit-dialog-fade
Nov 26, 2026
Merged

Moltenship merged 1 commit into
mainfrom
fix/a11y-webkit-dialog-fade

Conversation

@Moltenship

Copy link
Copy Markdown
Owner

Fixes the WebKit "event editor dialog" failures in the release gate's browsers step (run 45726058412), at the cause, in seriousViolations' wait (tools/a11y/tests/axe.ts).

The cause

Before axe runs, seriousViolations waits for the page's running animations to finish, so a fading popup can't fail contrast (#319). In Linux WebKit on a loaded runner, the dialog's 100 ms fade-in could already read finished while the page still showed an earlier frame of it. WebKit reads an animation's time from the clock when a script asks, but it puts the animated value on the page only when it renders a frame. On the runner, frames came 100 to 300 ms apart.

So the wait's first look found nothing running and returned. axe then measured a half-faded dialog and its backdrop. A diagnostic run on Linux WebKit (run 45729918494) recorded this in every failure:

pass: 2 animations, 0 running: dialog-overlay/CSSAnimation/finished/t=173, dialog-content/CSSAnimation/finished/t=173  popup opacity 0.936
axe starts  popup opacity 0.936
axe ended (549 ms)  popup opacity 1

Across the failures, the fades were 102–173 ms into their 100 ms, at 0.53 to 0.95 opacity.

The answers to the questions in the brief:

  • Does WebKit list the fades? Yes. document.getAnimations() lists the popup's and the backdrop's CSSAnimations in both engines, with the document's timeline. WebKit has no separate frame between data-starting-style going and the fade appearing: this dialog's fade is a CSS animation, which starts at mount, and it's listed from then on. What WebKit gets wrong is finished coming before the page shows the fade's end.
  • Why is the sidebar measured in light theme? axe measures it in both engines. Neither marks the page behind the dialog aria-hidden or inert (checked in both). Under a fully faded-in backdrop the sidebar passes. Mid-fade, axe measures it through the semi-transparent backdrop and it fails, which is the light-theme failure. In dark theme, the dialog's own text was faded too.

The fix

The wait now ends only after a frame in which nothing runs. When it finds nothing running, it waits one frame and looks again. A WebKit frame applies the fade's last value and drops the finished animations, so the second look finds the page at rest. This costs one frame per axe check in Chromium.

There's no longer timeout, no retry and no rule exclusion.

Evidence

Before After
CI, Linux WebKit, the two demo files in a loop the dialog test failed 7 of 24 times (12 runs, two themes) 0 failures in 13 runs; axe started at opacity 1 in all 156 dialog checks
CI, Linux WebKit, vp run browsers the dialog test failed, light theme 562 of 562 passed
Local, macOS WebKit, the two tests, 14 of 15 cores busy 0 of 20 (doesn't reproduce on macOS) 20 of 20 runs passed
  • The race on CI with the fix: it came up twice in the after-loop. Each time, the first look found both fades finished at 0.90 or 0.84 opacity. The frame came 196 or 297 ms later, with no animations left and opacity 1, and axe found 0 violations.
  • Diagnostic branch: the CI runs above come from diag/webkit-dialog-fade, a temporary diagnostic branch that isn't for merging.

Gate

On this head (6076ffe, on 8127d64):

  • vp run ready: green, 34 of 34 steps.
  • vp run browsers (macOS WebKit): green, 565 passed, 138 skipped.

🤖 Generated with Claude Code

seriousViolations waited for the page's running animations to finish
before axe ran. In Linux WebKit on a loaded runner, the event editor
dialog's fade could already read `finished`, 104 to 173 ms into its
100 ms, while the page still showed an earlier frame at 0.53 to 0.95
opacity: WebKit reads an animation's time from the clock but puts its
value on the page only in a frame. Nothing was running, so axe ran on the
half-faded dialog and its backdrop. The wait now ends only after a frame
with nothing running, by which time the end of the fade is on the page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Moltenship
Moltenship merged commit ec6ab72 into main Nov 26, 2026
3 checks passed
@Moltenship
Moltenship deleted the fix/a11y-webkit-dialog-fade branch November 26, 2026 01:45
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.

1 participant