Repository navigation
test(ChatLayout): the hiding-affordance contract reads visibility as focus leaves - #9003
Conversation
…focus leaves The check that the pill is still visible ran after polling for focus to leave; on a slow runner the fade had already finished. Visibility is now recorded by a one-time blur listener on the affordance, the moment focus leaves it. Same assertions. Test only. Original contract by @cixzhang in #7738.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Recommended for approval: recording the pill's visibility in a one-time blur listener checks the contract at the moment focus leaves, so runner speed no longer decides the result. The check still fails if the scroll button stops releasing focus immediately when it hides, so it keeps guarding the regression it was written for. Nothing further is needed from you.
[Automated review]
…n-visibility-at-blur
There was a problem hiding this comment.
Recommended for approval: recording the pill's visibility in a one-time blur listener checks the contract at the moment focus leaves, so runner speed no longer decides the result. The check still fails when the scroll button stops releasing focus as it hides, so it keeps guarding the regression it was written for, and merging main left the change itself untouched. Nothing further is needed from you.
[Automated review]
Maintainer impact
The release-time accessibility contracts can go red on a correct ChatLayout. In CI, "the hiding affordance releases focus before its fade finishes" failed: the scroll button's
visibilitywas alreadyhiddenwhen the test looked. A red release check on a healthy commit holds the release.Intended invariant
The contract is unchanged. When the scroll affordance hides, focus leaves it immediately (it becomes
inert), while itsvisibilityflips only after the fade. So focus has left while the button is still visible, and once the fade ends it is hidden.Change
The test checked
visibility: visibleafter polling for focus to leave. On a slow runner the fade can finish before that check runs, so it readhiddeneven though focus had left mid-fade.The test now records the pill's computed
visibilityfrom a one-timeblurlistener on the affordance, the moment focus leaves it, and asserts that value wasvisible. Chromium firesblurwhen the focused element becomes inert. The final "hidden after the fade" assertion is unchanged. Test only: no product code and no Changeset.Evidence
All runs were in Chromium against the Storybook built for the failing commit, with Playwright 1.61.1.
blurfiring withvisibility: visible, and the fade'stransitionendarriving 200-300 ms later.Scope
Testing
pnpm exec playwright test packages/core/src/Chat/__tests__/ChatLayoutScrollButton.a11y.chromium.spec.ts --project chromium -g "releases focus before its fade" --repeat-each=40 --fully-parallel, at normal load and under CPU saturation, before and after.prettier --checkandeslinton the file are clean.Credit: @cixzhang wrote this contract in #7738. This change only reads its "still visible" check at the moment focus leaves.
Posted by Cindy's agent on her behalf.