Commit ea846e2
authored
🤖 fix: blur after click in storybook play functions for deterministic snapshots (#1013)
## Summary
Fixes flaky Chromatic snapshots where the AIView container sometimes
shows a focus outline and sometimes doesn't.
## Problem
The AIView container has `tabIndex={0}` for keyboard scrolling
accessibility. When storybook play functions use `userEvent.click()` to
expand tool calls, the click can non-deterministically trigger
`focus-visible` on the container, causing intermittent focus outlines in
visual snapshots.
## Solution
Add `blur()` after clicks in affected play functions to ensure the
visual snapshot captures the intended state (expanded tool) without
unrelated focus styling.
This preserves the accessibility feature (focus outline) in production
while making the stories test what they're meant to test.
_Generated with `mux`_1 parent 30a8a91 commit ea846e2
1 file changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
| 253 | + | |
252 | 254 | | |
253 | 255 | | |
254 | 256 | | |
| |||
297 | 299 | | |
298 | 300 | | |
299 | 301 | | |
| 302 | + | |
| 303 | + | |
300 | 304 | | |
301 | 305 | | |
302 | 306 | | |
| |||
444 | 448 | | |
445 | 449 | | |
446 | 450 | | |
| 451 | + | |
| 452 | + | |
447 | 453 | | |
448 | 454 | | |
449 | 455 | | |
| |||
0 commit comments