Skip to content

Commit 5ca1eb8

Browse files
rrewllclaude
andcommitted
test(webview): finish CSS transitions after the visual theme changes
applyVisualTheme changes the theme classes after the story mounts. The Button transition-colors class then changes the border color over about 150 ms. expectContrast can read a color between the two themes, so the WelcomeViewProvider contrast check fails at random. Finish each running CSSTransition after the theme classes change. Other animation types stay as they are, because finishing an infinite CSS animation throws an error. Fixes #2326 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 4d1a543 commit 5ca1eb8

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎webview-ui/playwright/themes.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,11 @@ export async function applyVisualTheme(page: Page, theme: VisualTheme) {
2424
document.body.className = bodyClass
2525
document.body.removeAttribute("style")
2626
document.body.dataset.vscodeThemeId = themeId
27+
28+
for (const animation of document.getAnimations()) {
29+
if (animation instanceof CSSTransition) {
30+
animation.finish()
31+
}
32+
}
2733
}, theme)
2834
}

0 commit comments

Comments
 (0)