Skip to content

Validate transition styles without waiting for the animation - #68

Merged
hirasso merged 2 commits into
mainfrom
fix/validate-styles-without-wait
Nov 9, 2026
Merged

hirasso merged 2 commits into
mainfrom
fix/validate-styles-without-wait

Conversation

@hirasso

@hirasso hirasso commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Description

swup validate's transition-styles check was flaky under load. It added is-animating, waited a fixed duration + 100ms and then read the computed styles. With --parallel on a slow CI runner (e.g. 61 pages on a 2-core GitHub runner), Chromium falls behind rendering. The transition often hadn't moved yet after the fixed wait, so valid sites failed with Styles not changed.

This PR removes the waiting entirely:

  • Temporarily inject transition: none !important; animation: none !important
  • Compare computed styles of is-changing vs. is-changing is-animating. These now resolve instantly to their end values
  • Clean up classes and the injected style tag afterwards

The duration is still verified separately by the transition-duration check.

Also adds bypassCSP so that validateAnimationStyles works against websites using a CSP (style tag injected).

Testing

Against the swup docs site (61 pages):

  • swup validate --parallel: 61/61 passed (previously 17 failures on CI)
  • --styles=color (a property that doesn't change): correctly fails with Styles not changed

Note

addStyleTag injects an inline <style>, so a strict CSP style-src could block it. Can add bypassCSP to the page context if needed.

Checks

  • The PR is submitted to the main branch
  • The code was linted before pushing (npm run lint)
  • All tests are passing (npm run test)

@hirasso
hirasso requested a review from daun November 9, 2026 21:05
@hirasso hirasso mentioned this pull request Nov 9, 2026
3 tasks done
@hirasso
hirasso merged commit f31de5d into main Nov 9, 2026
1 check passed
@hirasso
hirasso deleted the fix/validate-styles-without-wait branch November 9, 2026 21:08
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.

2 participants