Repository navigation
fix(ChatMessageList, Tooltip, HoverCard): the chat log and text trigger spans draw the shared focus ring - #8876
Conversation
…er spans draw the shared focus ring Part of #8852
|
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.
Requesting changes for one evidence gap: in Chromium, the chat log and the text-only Tooltip and HoverCard triggers now draw the token focus ring as described (the log's ring inset inside its scroll area), and a theme override of the focus tokens reaches all three. The only regression test, ChatMessageList.focusRing.test.tsx, compares generated StyleX class names in jsdom, which cannot match :focus-visible, and copies the inset style it checks, so it would not catch the ring being lost or clipped. Please add Chromium focus-visible cases for the three tab stops (for example alongside Chat/__tests__/ChatMessageList.a11y.chromium.spec.ts) that Tab to each stop, assert the computed outline against the focus tokens, and check that the log's ring stays inside its scroll container.
[Automated review]
| const inset = stylex.create({ | ||
| ring: { | ||
| outlineOffset: { | ||
| default: null, | ||
| ':focus-visible': `calc(-1 * ${focusVars['--focus-outline-width']})`, | ||
| }, | ||
| }, | ||
| }); |
There was a problem hiding this comment.
This repeats focusRingInset from ChatMessageList.tsx and compares generated StyleX class names in jsdom, which cannot match :focus-visible, so the case would still pass if the log's ring were clipped or never painted. A Chromium case in Chat/__tests__/ChatMessageList.a11y.chromium.spec.ts that Tabs into an overflowing log and reads the computed outline and its room inside the scroller (as readFocusRingRoom does in ChatLayoutScrollButtonSurface.a11y.chromium.spec.ts) would observe the fix itself.
| * @input Uses ChatMessageList, Tooltip, HoverCard, focusOutlineStyles | ||
| * @output Tests that the chat log and the text-only Tooltip and HoverCard | ||
| * trigger spans draw the shared focus ring | ||
| * @position Colocated test; the ring's geometry is checked in a real browser |
There was a problem hiding this comment.
No committed check verifies the ring's geometry in a real browser yet; once the Chromium case exists, point this line at it.
…ed focus ring on the three tab stops CodeBunny asked for real-browser cases: jsdom never matches :focus-visible. FocusRingTextTriggers.a11y.chromium.spec.ts tabs through the chat log and the text-only Tooltip and HoverCard spans in a new no-visual story and checks that each draws the ring the focus tokens resolve to, that a theme's --focus-outline-* values restyle all three, and that the log's ring (offset minus its width) stays inside the area that scrolls it.
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| ChatComposer | 67.2 kB (+104 B) · 10.6 kB CSS (0) | — | ✗ · ✓ · — |
| ChatComposerInput | 65.1 kB (+76 B) · 10.1 kB CSS (0) | — | ✗ · ✓ · — |
| ChatComposerTokenElement | 65.1 kB (+75 B) · 10.1 kB CSS (0) | — | ✗ · ✓ · — |
110 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| ChatSendButton | 51.0 kB (+37 B) · 8.7 kB CSS (0) | — | ✗ · ✓ · — |
| ChatMessageList | 23.0 kB (+11 B) · 6.9 kB CSS (+19 B) | — | ✗ · ✓ · — |
| ChatDictationButton | 51.1 kB (+19 B) · 8.8 kB CSS (0) | — | ✗ · ✓ · — |
| ChatLayoutScrollButton | 51.1 kB (+15 B) · 8.9 kB CSS (0) | — | ✗ · ✓ · — |
| ChatToolCalls | 26.1 kB (+11 B) · 8.3 kB CSS (0) | — | ✗ · ✓ · — |
| ChatComposerDrawer | 17.7 kB (0) · 4.7 kB CSS (0) | — | ✗ · ✓ · — |
| ChatMessage | 16.8 kB (0) · 3.7 kB CSS (0) | — | ✗ · ✓ · ✓ |
| ChatMessageBubble | 7.2 kB (0) · 3.7 kB CSS (0) | — | ✗ · ✓ · ✓ |
| ChatMessageMetadata | 19.9 kB (0) · 4.1 kB CSS (0) | — | ✗ · ✓ · — |
| ChatSystemMessage | 7.0 kB (0) · 3.8 kB CSS (0) | — | ✗ · ✓ · — |
| ChatTokenizedText | 7.2 kB (0) · 4.0 kB CSS (0) | — | ✗ · ✓ · — |
| ChatLayout | 53.8 kB (−16 B) · 9.3 kB CSS (0) | — | ✗ · ✓ · — |
| Chat | — | — | ✗ · ✓ · — |
| RadioList | 48.0 kB (+604 B) · 6.8 kB CSS (+343 B) | — | — · — · — |
| HoverCard · Storybook | 24.3 kB (+573 B) · 4.3 kB CSS (+348 B) | 731 (+1) | ✓ · ✓ · — |
| Tooltip · Storybook | 25.6 kB (+562 B) · 4.3 kB CSS (+354 B) | 820 (+1) | ✓ · ✓ · ✓ |
| FieldLabel | 42.7 kB (+545 B) · 5.2 kB CSS (+354 B) | — | — · — · — |
| Field | 46.6 kB (+555 B) · 6.7 kB CSS (+341 B) | — | — · — · — |
| Text | 7.5 kB (+68 B) · 5.3 kB CSS (+354 B) | — | — · — · — |
| Heading | 8.0 kB (+66 B) · 5.3 kB CSS (+354 B) | — | — · — · — |
| Spinner | 18.7 kB (+65 B) · 6.1 kB CSS (+349 B) | — | — · — · — |
| TopNavHeading | 65.0 kB (+188 B) · 9.9 kB CSS (0) | — | — · — · — |
| SideNavHeading | 65.6 kB (+168 B) · 10.0 kB CSS (0) | — | — · — · — |
| richtext/RichTextView | 268.0 kB (+152 B) · 2.3 kB CSS (0) | — | — · — · — |
| NumberInput | 61.8 kB (+151 B) · 10.2 kB CSS (0) | — | — · — · — |
| charts/Chart | 171.5 kB (+148 B) · 494 B CSS (0) | — | — · — · — |
| charts/ChartTooltip | 148.9 kB (+145 B) · 423 B CSS (0) | — | — · — · — |
| SideNavItem | 60.6 kB (+136 B) · 9.9 kB CSS (0) | — | — · — · — |
| lab/Comments | 279.3 kB (+132 B) · 2.5 kB CSS (0) | — | — · — · — |
| Typeahead | 69.0 kB (+131 B) · 11.3 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 287.6 kB (+128 B) · 2.6 kB CSS (0) | — | — · — · — |
| TimeInput | 142.8 kB (+126 B) · 14.6 kB CSS (0) | — | — · — · — |
| Thumbnail | 55.0 kB (+121 B) · 10.3 kB CSS (0) | — | — · — · — |
| TextInput | 58.4 kB (+111 B) · 10.0 kB CSS (0) | — | — · — · — |
| InputGroup | 48.3 kB (+107 B) · 7.3 kB CSS (0) | — | — · — · — |
| Tokenizer | 79.3 kB (+107 B) · 17.2 kB CSS (0) | — | — · — · — |
| TextArea | 53.4 kB (+106 B) · 8.9 kB CSS (0) | — | — · — · — |
| FileInput | 59.3 kB (+101 B) · 9.7 kB CSS (0) | — | — · — · — |
| Switch | 93.9 kB (+101 B) · 9.5 kB CSS (0) | — | — · — · — |
| Slider | 96.3 kB (+97 B) · 8.3 kB CSS (0) | — | — · — · — |
| CheckboxInput | 57.5 kB (+95 B) · 9.0 kB CSS (0) | — | — · — · — |
| CodeBlock | 65.1 kB (+95 B) · 10.0 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 114.3 kB (+95 B) · 1.9 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 273.5 kB (+85 B) · 2.4 kB CSS (0) | — | — · — · — |
| StatusDot | 27.3 kB (+81 B) · 5.3 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 76.3 kB (+78 B) · 722 B CSS (0) | — | — · — · — |
| CheckboxList | 49.8 kB (+75 B) · 7.5 kB CSS (0) | — | — · — · — |
| RadioListItem | 60.6 kB (+75 B) · 9.6 kB CSS (0) | — | — · — · — |
| Link | 48.1 kB (+73 B) · 6.9 kB CSS (0) | — | — · — · — |
| BaseTypeahead | 61.0 kB (+67 B) · 9.7 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 238.7 kB (+66 B) · 454 B CSS (0) | — | — · — · — |
| Selector | 88.1 kB (+64 B) · 16.3 kB CSS (0) | — | — · — · — |
| Table | 97.4 kB (+64 B) · 17.0 kB CSS (0) | — | — · — · — |
| ContextMenu | 88.1 kB (+62 B) · 16.4 kB CSS (0) | — | — · — · — |
| Pagination | 98.1 kB (+60 B) · 16.7 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 91.9 kB (+57 B) · 1.9 kB CSS (0) | — | — · — · — |
| DialogHeader | 53.4 kB (+55 B) · 10.3 kB CSS (0) | — | — · — · — |
| IconButton | 50.6 kB (+55 B) · 8.7 kB CSS (0) | — | — · — · — |
| lab/TransferList | 84.8 kB (+55 B) · 1.7 kB CSS (0) | — | — · — · — |
| AppShell | 80.4 kB (+54 B) · 12.3 kB CSS (0) | — | — · — · — |
| lab/SelectableCardGroup | 55.7 kB (+54 B) · 162 B CSS (0) | — | — · — · — |
| Markdown | 159.2 kB (+53 B) · 19.3 kB CSS (0) | — | — · — · — |
| MultiSelector | 85.3 kB (+52 B) · 15.7 kB CSS (0) | — | — · — · — |
| TableCell | 89.3 kB (+52 B) · 16.8 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 60.0 kB (+52 B) · 10.6 kB CSS (0) | — | — · — · — |
| ComplexSelector | 61.4 kB (+49 B) · 10.5 kB CSS (0) | — | — · — · — |
| Banner | 52.6 kB (+47 B) · 9.3 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 63.7 kB (+47 B) · 10.8 kB CSS (0) | — | — · — · — |
| DateRangeInput | 80.4 kB (+46 B) · 11.3 kB CSS (0) | — | — · — · — |
| ToggleButton | 51.5 kB (+46 B) · 8.8 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 88.9 kB (+45 B) · 16.5 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 60.2 kB (+45 B) · 11.9 kB CSS (0) | — | — · — · — |
| TopNavMenu | 64.8 kB (+45 B) · 10.0 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 50.9 kB (+43 B) · 8.7 kB CSS (0) | — | — · — · — |
| PowerSearch | 262.6 kB (+42 B) · 22.7 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 52.3 kB (+40 B) · 1.2 kB CSS (0) | — | — · — · — |
| Lightbox | 58.7 kB (+39 B) · 9.2 kB CSS (0) | — | — · — · — |
| TabMenu | 62.0 kB (+39 B) · 9.9 kB CSS (0) | — | — · — · — |
| ListItem | 62.7 kB (+38 B) · 10.8 kB CSS (0) | — | — · — · — |
| Carousel | 57.4 kB (+37 B) · 9.5 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 73.6 kB (+37 B) · 773 B CSS (0) | — | — · — · — |
| DrawerHeader | 53.6 kB (+35 B) · 11.7 kB CSS (0) | — | — · — · — |
| Button | 50.6 kB (+33 B) · 8.7 kB CSS (0) | — | — · — · — |
| MobileNav | 60.4 kB (+29 B) · 9.4 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 74.1 kB (+26 B) · 1.1 kB CSS (0) | — | — · — · — |
| SideNav | 80.3 kB (+24 B) · 10.2 kB CSS (0) | — | — · — · — |
| Calendar | 61.4 kB (+23 B) · 9.3 kB CSS (0) | — | — · — · — |
| lab/ListInput | 90.1 kB (+20 B) · 1.6 kB CSS (0) | — | — · — · — |
| CommandPaletteInput | 27.0 kB (+16 B) · 7.5 kB CSS (0) | — | — · — · — |
| lab/Schedule | 69.0 kB (+12 B) · 3.9 kB CSS (0) | — | — · — · — |
| DropdownMenu | 85.0 kB (+9 B) · 16.5 kB CSS (0) | — | — · — · — |
| Stepper | 52.2 kB (+8 B) · 8.9 kB CSS (0) | — | — · — · — |
| lab/DiffViewer | 76.9 kB (+8 B) · 2.1 kB CSS (0) | — | — · — · — |
| ProgressBar | 11.5 kB (+6 B) · 6.2 kB CSS (0) | — | — · — · — |
| DateInput | 165.8 kB (+2 B) · 15.6 kB CSS (0) | — | — · — · — |
| charts/ChartLegend | 35.6 kB (−1 B) · 224 B CSS (0) | — | — · — · — |
| Timestamp | 22.9 kB (−2 B) · 8.9 kB CSS (0) | — | — · — · — |
| SideNavCollapseButton | 51.4 kB (−3 B) · 8.8 kB CSS (0) | — | — · — · — |
| TopNav | 62.1 kB (−3 B) · 9.7 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 63.6 kB (−6 B) · 9.4 kB CSS (0) | — | — · — · — |
| Timer | 9.6 kB (−7 B) · 5.9 kB CSS (0) | — | — · — · — |
| AlertDialog | 94.0 kB (−8 B) · 13.2 kB CSS (0) | — | — · — · — |
| Toast | 64.5 kB (−8 B) · 9.1 kB CSS (0) | — | — · — · — |
| CommandPalette | 58.7 kB (−11 B) · 12.4 kB CSS (0) | — | — · — · — |
| MoreMenu | 85.3 kB (−18 B) · 16.5 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 75.3 kB (−21 B) · 11.4 kB CSS (0) | — | — · — · — |
| Popover | 59.9 kB (−22 B) · 12.9 kB CSS (0) | — | — · — · — |
| DateTimeInput | 188.3 kB (−26 B) · 17.3 kB CSS (0) | — | — · — · — |
| lab/TourStep | 66.0 kB (−40 B) · 590 B CSS (0) | — | — · — · — |
| chat | — | — | — · ✓ · — |
Visual changes: 4 snapshots in 1 component
A change is a question for the reviewer, not a failure.
| Component · story | Before | After | Diff |
|---|---|---|---|
| Chat · Default (neutral, dark) | ![]() |
![]() |
![]() |
| Chat · Default (neutral, light) | ![]() |
![]() |
![]() |
| Chat · Clipping (neutral, dark) | ![]() |
![]() |
![]() |
| Chat · Clipping (neutral, light) | ![]() |
![]() |
![]() |
Package size: @astryxdesign/core 6.62 MB packed (+705 B); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 19 rows, core 23 rows; run pnpm api:report.
Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Requesting changes for one CI problem: the new Chromium spec's routing line lists core/utils as a @pr-a11y scope token, which the routing parser rejects, so parseRouting throws and the PR accessibility run stops before any spec runs (the repository test "gives every spec valid routing lines" now fails). Replace that token with a path token such as ^packages/core/src/utils/focusOutline, or drop it. The fix itself checks out: in Chromium the chat log and both text triggers draw the token ring, a theme's focus tokens reach all three, the log's ring stays inside its scroller, and the new spec fails with the three source edits reverted.
[Automated review]
| @@ -0,0 +1,173 @@ | |||
| // Copyright (c) Meta Platforms, Inc. and affiliates. | |||
| // @pr-a11y scope core/Chat core/Tooltip core/HoverCard core/utils ^apps/storybook/stories/FocusRingTextTriggers | |||
There was a problem hiding this comment.
core/utils is not a valid @pr-a11y scope token: parseRouting in .github/scripts/a11y-pr-contracts.mjs accepts only a ^ path pattern or <package>/<Component>, so it throws @pr-a11y scope token is not a component: core/utils. The script parses every spec's routing lines first, so the whole PR accessibility run stops, and a11y-pr-contracts.test.mjs ("gives every spec valid routing lines") fails. A path token keeps the intent:
// @pr-a11y scope core/Chat core/Tooltip core/HoverCard ^packages/core/src/utils/focusOutline ^apps/storybook/stories/FocusRingTextTriggers| // The log fills the area that scrolls it, which clips at its edges, so its | ||
| // keyboard ring sits inside its own box instead of around it. |
There was a problem hiding this comment.
Non-blocking: this keeps a real reason, but it is one 26-word sentence with three topics. Suggested: "The log fills its scroll area, and that area clips its edges. So the ring sits inside the log."
| // A tab stop: the shared ring, which a theme restyles through the | ||
| // focus-outline tokens. |
There was a problem hiding this comment.
Non-blocking: this narrates the call below; focusOutlineStyles.focusVisible already says it is the shared ring. Consider deleting it.
| // The span is a tab stop Astryx adds: it draws the shared ring, | ||
| // which a theme restyles through the focus-outline tokens. |
There was a problem hiding this comment.
Non-blocking: this narrates focusOutlineProps.focusVisible below it. Consider deleting it.
| // The span is a tab stop Astryx adds: it draws the shared ring, | ||
| // which a theme restyles through the focus-outline tokens. |
There was a problem hiding this comment.
Non-blocking: this narrates focusOutlineProps.focusVisible below it. Consider deleting it.
There was a problem hiding this comment.
The routing line now uses a valid path token, so the touched-components check runs the new Chromium spec and it passes, and the fix itself checks out: in Chromium the chat log and both text triggers draw the theme's focus ring, a theme's focus tokens reach all three, and the log's ring stays inside its scroller. Optionally, drop the comments above the three stylex.props calls, which restate the call's name, and split the 26-word comment on focusRingInset into shorter sentences.
[Automated review]
There was a problem hiding this comment.
Approved pending CI: the required test, build and docsite-test suites are deferred on this head and run when all CI jobs are re-run before merge.
The fix checks out: in Chromium the chat log and both text-only triggers now draw the theme's focus ring, a theme's focus tokens reach all three, and the log's ring stays inside its scroll area. The new Chromium spec passes on this head and fails with the three source edits reverted. Optionally, drop the comments above the three ring calls, which restate the call under them, and split the 26-word comment on focusRingInset into shorter sentences.
[Automated review]












Part of #8852 (ChatMessageList, Tooltip and HoverCard; Table is #8873, CodeBlock and Carousel #8875). With this one, all seven tab stops in #8852 are covered.
User impact
Three tab stops Astryx adds draw the browser's default focus ring instead of the theme's:
role="log", focusable so keyboard users can scroll a long conversation);Tooltipwraps around text-only children;HoverCard.The default ring has its own colour, width and style and differs per browser, and on the chat log it falls partly outside the area that scrolls it. After this change all three draw the theme-driven ring every other Astryx control draws.
Problem and solution fit
tabIndex={0}) but carries no ring style, so it falls back to the user-agent default. WCAG 2.4.7 needs a visible indicator, and the--focus-outline-*tokens are how Astryx draws one.All three compose the shared ring. The log's is inset by its own width, as in the Table scroll wrapper.
Expected behavior and authority
architecture:interaction-modalitynamesutils/focusOutline.stylex.tsand the focus tokens as the shared focus-indicator mechanics and theme seam.Smallest restoration
ChatMessageList.tsx: the log composesfocusOutlineStyles.focusVisibleplus an inset offset, before the caller'sxstyle.Tooltip.tsx,HoverCard.tsx: the text-only wrapper span composesfocusOutlineProps.focusVisible.Evidence
Real Chrome 156 (headless, DPR 2), Storybook from
mainand from this branch. Focus was reached by real Tab presses:mainauto 1pxUA ring; top and left edges 1px past the scroll areasolid 2pxtheme colour, offset-2px; whole along every visible edgeauto 1pxUA ringsolid 2pxtheme colour, offset3pxauto 1pxUA ringsolid 2pxtheme colour, offset3pxChatMessageList.focusRing.test.tsx, 3 cases, all failing onmain. It pins the composition, since jsdom doesn't match:focus-visible.Scope
Testing
pnpm vitest runfor the suites above: 152 pass, with the new tests failing first.tsc --noEmitfor core, eslint, prettier.