Repository navigation
fix(CodeBlock, Carousel): the code viewport and the scroller draw the shared focus ring - #8875
Conversation
… 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.
Changes requested: moving both elements onto the shared focus ring and its tokens is the right fix, and the CodeBlock half works as described, but on an overflowing Carousel the scroller's own edge-fade mask still hides the ring on its faded side. Please paint the ring where the mask does not reach (or move the fade off the focusable scroller), and back the fix with a real-browser check.
- With the default edge fade, the ring's inline-end edge at rest, and both side edges mid-scroll, paint at about a quarter of the ring's strength on the
Defaultstory, so the changeset's "no longer cuts them off" does not hold for Carousel yet. - The new tests compare StyleX class names in jsdom, which cannot match
:focus-visibleor see paint; a case in the existing CodeBlock and Carousel Chromium specs that tabs in and checks the rendered ring would cover this.
[Automated review]
| // A tab stop: the shared ring, which a theme restyles through the | ||
| // focus-outline tokens. | ||
| focusOutlineStyles.focusVisible, | ||
| styles.scrollerFocusRingInset, |
There was a problem hiding this comment.
This ring sits on the element that also carries the edge-fade mask-image (applied a few lines below through fadeStyle). A mask covers everything its element paints, outline included, and the inset puts the side edges inside the mask's 0–30% ramp: on the Default story at rest the inline-end edge paints at about a quarter of the ring's strength, and mid-scroll both side edges do. Painting the ring where the mask does not reach (for example a root-level overlay shown while the scroller matches :focus-visible), or moving the fade off the focusable element, would keep it whole.
| const inset = stylex.create({ | ||
| ring: { | ||
| outlineOffset: { | ||
| default: null, | ||
| ':focus-visible': `calc(-1 * ${focusVars['--focus-outline-width']})`, | ||
| }, | ||
| }, | ||
| }); |
There was a problem hiding this comment.
This re-creates the components' own inset declaration and then checks that the element carries the same atoms, in jsdom, which neither matches :focus-visible nor paints, so the tests pass while the Carousel ring is masked on its faded side. A case in the existing Chromium specs (CodeBlockOverflowStop.a11y.chromium.spec.ts, Carousel.a11y.chromium.spec.ts) that tabs to the element and checks the computed outline and that each edge paints would guard the actual outcome.
…mask no longer erases it; a Chromium spec checks both rings paint whole
|
/approve-spec d596876 |
There was a problem hiding this comment.
Changes requested: the CodeBlock half works as described, and moving the Carousel ring to the root fixes the edge fade on the Default story, but on carousels whose slides fill the height the slides now cover most of the ring.
- On an overflowing Carousel with full-height slides (
Card Content,Color Swatches), the scroller's edge-fade mask makes it a stacking context that paints over the root's inset ring, so only short stubs of the top, bottom and inline-start edges stay visible; paint the ring above the scroller (for example a root overlay built from the shared focus-outline styles) or move the mask off the ringed box. - The new Chromium spec checks computed outline styles and ancestor masks rather than paint, so it passes on
Card Contentwith the ring hidden; add a full-height-slide case that checks the painted ring edges. - Newly live check: the description says the base clip cuts off the carousel ring's bottom edge, but on the base
Defaultstory that edge paints in full and the base loss is the faded inline-end edge, and its "Smallest restoration" bullet still describes the scroller painting the ring; please correct both. - The
Carousel.doc.mjsrewrap changes no content and conflicts withmain; please drop it from this pull request.
With those fixed, the changeset's "show whole" wording will match what ships.
[Automated review]
| stylex.props( | ||
| styles.root, | ||
| // The scroller is the root's first child and its tab stop. | ||
| focusOutlineStyles.focusWithinFirstChild, |
There was a problem hiding this comment.
While the content overflows, the scroller's edge-fade mask-image makes it a stacking context that Chromium paints after this root's outline, so slides that reach the scroller's top or bottom cover the inset ring: on Card Content only 148 of 1,000 top-edge device pixels stay visible, against all 1,000 with the mask removed. Painting the ring above the scroller (a root overlay stacked over it, from the shared focus-outline styles) or moving the mask off this box would keep it whole.
| } | ||
|
|
||
| /** Find which element paints the focused element's ring, and measure it. */ | ||
| async function measureRing(page: Page): Promise<RingPaint> { |
There was a problem hiding this comment.
This measures computed outline style and width plus ancestor masks and clips, not paint, so on Card Content it returns a whole ring (masked: [], clipped: []) while the slides hide most of it. A full-height-slide case that samples the ring's edge pixels in a screenshot would catch that.
| displayName: 'Carousel', | ||
| category: 'Container', | ||
| keywords: ['carousel', 'slider', 'scroll', 'gallery', 'filmstrip', 'swiper', 'horizontal', 'overflow', 'snap'], | ||
| keywords: [ |
There was a problem hiding this comment.
This file only changes formatting (all three exports are deep-equal to the base), and merging main conflicts here; dropping it keeps the fix focused.
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Carousel · Storybook | 58.1 kB (+241 B) · 9.7 kB CSS (+202 B) | 505 (+12) | ✓ · ✓ · ✓ |
| PowerSearch | 263.3 kB (+141 B) · 22.9 kB CSS (+128 B) | — | — · — · — |
| Pagination | 98.7 kB (+139 B) · 16.9 kB CSS (+103 B) | — | — · — · — |
6 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Selector | 88.7 kB (+139 B) · 16.5 kB CSS (+96 B) | — | — · — · — |
| CodeBlock · Storybook | 65.5 kB (+42 B) · 10.1 kB CSS (+18 B) | 2,225 (+10) | ✓ · ✓ · ✓ |
| Markdown | 160.1 kB (+45 B) · 19.3 kB CSS (0) | — | — · — · — |
| lab/Comments | 280.6 kB (new) · 2.5 kB CSS (new) | — | — · — · — |
| lab/CommentThread | 274.8 kB (new) · 2.4 kB CSS (new) | — | — · — · — |
| richtext/RichTextEditorToolbar | 239.3 kB (new) · 454 B CSS (new) | — | — · — · — |
Package size: measured; main has no measurement of the merge base to compare yet.
API changes: cli +14 · ~5 · −0 (against the merge base's committed report)
Committed API report behind this build: cli 19 rows, core 23 rows; run pnpm api:report.
19 API changes (advisory)
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| + | cli |
./api · Types · type SearchResultEntry |
deprecated?: ComponentDeprecation | undefined |
import type {SearchResultEntry} from '@astryxdesign/cli/api'; const x: SearchResultEntry = {deprecated: …} |
| + | cli |
./authoring · Types · interface ComponentDeprecation |
interface ComponentDeprecation |
import type {ComponentDeprecation} from '@astryxdesign/cli/authoring' |
| + | cli |
./authoring · Types · interface ComponentIconSlotDoc |
interface ComponentIconSlotDoc |
import type {ComponentIconSlotDoc} from '@astryxdesign/cli/authoring' |
| + | cli |
./authoring · Types · interface ComponentIconSlotStateDoc |
interface ComponentIconSlotStateDoc |
import type {ComponentIconSlotStateDoc} from '@astryxdesign/cli/authoring' |
| + | cli |
./authoring · Types · interface MultiComponentDoc |
deprecated?: ComponentDeprecation |
import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {deprecated: …} |
| + | cli |
./authoring · Types · interface SingleComponentDoc |
deprecated?: ComponentDeprecation |
import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {deprecated: …} |
| + | cli |
./doc · Types · interface ComponentBaseDoc |
deprecated?: ComponentDeprecation |
import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {deprecated: …} |
| + | cli |
./doc · Types · interface SubComponentDoc |
deprecated?: ComponentDeprecation |
import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {deprecated: …} |
| + | cli |
./doc · Also exported from an earlier entry point · ComponentDeprecation |
ComponentDeprecation (./authoring) |
import {ComponentDeprecation} from '@astryxdesign/cli/doc' |
| + | cli |
./doc · Also exported from an earlier entry point · ComponentIconSlotDoc |
ComponentIconSlotDoc (./authoring) |
import {ComponentIconSlotDoc} from '@astryxdesign/cli/doc' |
| + | cli |
./doc · Also exported from an earlier entry point · ComponentIconSlotStateDoc |
ComponentIconSlotStateDoc (./authoring) |
import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/doc' |
| + | cli |
./template · Also exported from an earlier entry point · ComponentDeprecation |
ComponentDeprecation (./authoring) |
import {ComponentDeprecation} from '@astryxdesign/cli/template' |
| + | cli |
./template · Also exported from an earlier entry point · ComponentIconSlotDoc |
ComponentIconSlotDoc (./authoring) |
import {ComponentIconSlotDoc} from '@astryxdesign/cli/template' |
| + | cli |
./template · Also exported from an earlier entry point · ComponentIconSlotStateDoc |
ComponentIconSlotStateDoc (./authoring) |
import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/template' |
| ~ | cli |
./api · Functions · function search |
function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "hook" | "theme" | "doc" | undefined; limit?: number | undefined }) => Promise<SearchResponse> → function search: (query: string, options?: { cwd?: string | undefined; type?: "template" | "component" | "doc" | "theme" | "hook" | undefined; limit?: number | undefined }) => Promise<SearchResponse> |
import {search} from '@astryxdesign/cli/api'; search(…) |
| ~ | cli |
./authoring · Types · interface MultiComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {theming: …} |
| ~ | cli |
./authoring · Types · interface SingleComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {theming: …} |
| ~ | cli |
./doc · Types · interface ComponentBaseDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {theming: …} |
| ~ | cli |
./doc · Types · interface SubComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {theming: …} |
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested: thanks for dropping the doc rewrap. The CodeBlock half works as described, but on carousels whose slides fill the height, the slides still cover most of the new ring.
- On an overflowing Carousel with full-height slides (
Card Content,Custom Content (Swatches)), the scroller's edge-fade mask makes it a stacking context that paints over the root's inset ring, so only short stubs of the top, bottom and inline-start edges stay visible; paint the ring above the scroller (for example a root overlay built from the shared focus-outline styles) or move the mask off the ringed box. - The new Chromium spec checks computed outline styles and ancestor masks rather than paint, so it passes on
Card Contentwith the ring hidden; add a full-height-slide case that checks the painted ring edges. - Newly live check: the description says the base clip cuts off the carousel ring's bottom edge, but on the base
Defaultstory that edge paints in full (the base loss is the faded inline-end edge), and its "Smallest restoration" bullet still describes the scroller painting the ring; please correct both.
With those fixed, the changeset's "show whole" wording will match what ships.
[Automated review]
…roller; the Chromium spec checks painted edges, full-height slides included
… StyleX can resolve them
|
/approve-spec 38f9caf |
There was a problem hiding this comment.
Changes requested. The ring itself now looks right: in Chromium the CodeBlock viewport and the Carousel scroller both draw the theme's ring, whole on every edge, at rest and mid-scroll, including full-height card slides. Four things block merging:
Carousel.tsxadds the--_carousel-ring-stylecustom property, which fails the existingderivedVarRegistry.test.tscheck "Carousel: all source vars are in doc file" (red intest-ui).CarouselFocusRing.a11y.chromium.spec.tsimports@astryxdesign/a11y-spec/playwright, a subpath this branch's harness does not export, so core's typecheck fails with 7 errors and the accessibility-contracts job cannot run the spec; mergemaininto the branch or import from the subpaths this base exports.- The Carousel overlay re-creates the shared ring locally (the
:has(> :first-child:focus-visible)condition plus the width, style and colour), so please add the overlay as a variant inutils/focusOutline.stylex.tsand have Carousel's root make one call to it, which also removes the custom property above. - The 119 files under
packages/core/src/i18n/generated-english/are generator output frommain, whichmainignores and nothing on this branch imports; please remove them from the branch.
A non-blocking wording suggestion for the overlay's code comment is inline.
[Automated review]
| focusRingOverlay: { | ||
| '--_carousel-ring-style': { | ||
| default: 'none', | ||
| ':has(> :first-child:focus-visible)': focusVars['--focus-outline-style'], | ||
| }, | ||
| '::after': { | ||
| content: '""', | ||
| position: 'absolute', | ||
| inset: 0, | ||
| pointerEvents: 'none', | ||
| borderRadius: 'inherit', | ||
| outlineStyle: 'var(--_carousel-ring-style)', | ||
| outlineWidth: focusVars['--focus-outline-width'], | ||
| outlineColor: focusVars['--focus-outline-color'], | ||
| outlineOffset: `calc(-1 * ${focusVars['--focus-outline-width']})`, | ||
| }, | ||
| }, |
There was a problem hiding this comment.
This re-creates the shared ring in the component: the :has(> :first-child:focus-visible) condition is the one focusOutlineStyles.focusWithinFirstChild already owns, and the width, style and colour longhands are restated on the ::after. Two consequences: a later fix to the shared ring will not reach Carousel, and the new --_carousel-ring-style fails derivedVarRegistry.test.ts ("Carousel: all source vars are in doc file"). Adding the overlay as a variant in utils/focusOutline.stylex.ts (ring on ::after, inset by its width, same condition) and composing it here as one call would fix both.
| // The scroller's keyboard ring is an overlay on the root, painted after the | ||
| // scroller: the scroller's edge-fade mask would erase a ring the scroller | ||
| // painted itself, and makes the scroller a stacking context that covers a | ||
| // ring painted by the root. The ring sits inside the root's clipped box. |
There was a problem hiding this comment.
Non-blocking: the first sentence is 43 words and carries several topics. A shorter version that keeps the reason: "The scroller's edge-fade mask erases a ring the scroller paints. The mask also makes the scroller a stacking context that covers a ring on the root. So the root paints the ring on an overlay above the scroller."
| * :focus-visible or paint | ||
| */ | ||
|
|
||
| import {expect, test, type Page} from '@astryxdesign/a11y-spec/playwright'; |
There was a problem hiding this comment.
On this branch internal/a11y-spec/package.json exports only ., ./chromium and ./storybook; ./playwright exists only on main. Core's typecheck fails here (plus six implicit-any errors that follow from it), and the accessibility-contracts job stops at "Package subpath './playwright' is not defined by exports", so this spec never runs at this head. Merging main into the branch, or importing from the exported subpaths, would let it run.
| // Copyright (c) Meta Platforms, Inc. and affiliates. | ||
|
|
||
| /** | ||
| * @generated by scripts/generate-i18n-runtime.mjs from packages/core/locales/en.json, |
There was a problem hiding this comment.
This and the other 118 files under generated-english/ are output of main's i18n generator (this branch's generator does not write this directory), and main's .gitignore excludes the directory. Nothing on this branch imports them and 61 of their strings differ from this branch's en.json; once merged they would be tracked files that every pnpm install rewrites. Please remove the directory from the branch.
… entry; interaction-modality INV1 names it
|
/approve-spec f6cacd4 |
There was a problem hiding this comment.
Changes requested: both rings now look right, since in Chromium the CodeBlock viewport and the Carousel scroller paint the theme's 2px ring inside their components, and the Carousel ring is whole on every edge at rest, mid-scroll and in right-to-left. The earlier unit-test, typecheck and stray-file problems are fixed.
Blocking:
- The Carousel root paints its scroller's ring with a new
:has(> :first-child:focus-visible)overlay ininternal/focusOutline.stylex.tsinstead of the shared focus-owner style and attribute thatarchitecture:interaction-modalityINV3 onmainnow requires for a wrapper that rings one primary control among other tab stops (Carousel.tsx:601), so after mergingmainthe overlay belongs inprivateAttributes/focusOwner.stylex.ts, keyed on the owner attribute withfocusOwnerPropson the scroller (or an engineering owner amends INV3 to name the overlay), with the INV1 sentence updated to match and the new head re-approved.
CI did not run on this head because the run found no room under the CI ceiling, so it needs a re-run with the next push. The inline comments also carry three small non-blocking cleanups.
[Automated review]
| styles.root, | ||
| // The scroller is the root's first child and its tab stop. Its | ||
| // edge-fade mask would cover a ring the root draws itself. | ||
| focusOverlayStyles.firstChild, |
There was a problem hiding this comment.
This root rings for one primary control (the scroller) among other tab stops, which architecture:interaction-modality INV3 on main now routes through privateAttributes/focusOwner.stylex.ts: the primary carries focusOwnerProps and the wrapper ring keys on that attribute, so nested owners and sibling controls ring themselves and a fix to the wrapper ring reaches every wrapper. focusOverlayStyles.firstChild keys on :first-child instead, a second copy of focusWithinFirstChild's condition. After merging main, an overlay export in the focus-owner module (only that file may write the attribute's selector) plus {...focusOwnerProps} on the scroller would meet INV3 and keep the overlay; the INV1 sentence would then name that module.
| radiusVars, | ||
| durationVars, | ||
| easeVars, | ||
| focusVars, |
There was a problem hiding this comment.
Non-blocking: focusVars is no longer used in this file now that the overlay lives elsewhere (@typescript-eslint/no-unused-vars warns).
| @@ -0,0 +1,243 @@ | |||
| // Copyright (c) Meta Platforms, Inc. and affiliates. | |||
| // @pr-a11y scope ^(packages/core/src/(Carousel|CodeBlock)/|packages/core/src/utils/focusOutline|apps/storybook/stories/(Carousel|CodeBlock)\.stories) | |||
There was a problem hiding this comment.
Non-blocking: this scope still names utils/focusOutline but not the module that now draws the Carousel ring, so a labelled accessibility run skips this spec when only the overlay changes. Adding that module's path keeps the painted-ring check attached to the code it guards.
| // A tab stop while the code overflows: the shared ring, which a theme | ||
| // restyles through the focus-outline tokens. |
There was a problem hiding this comment.
Non-blocking: the second half restates what focusOutlineProps.focusVisible is. A shorter comment that keeps the reason: "The viewport is a tab stop only while the code overflows."
… focus-owner overlay ring (interaction-modality INV3); the internal entry is gone
|
/approve-spec 2858800 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet (the run was cancelled for lack of capacity), so it needs a re-run before merge.
Both rings now come from the theme's focus tokens: the CodeBlock viewport's ring sits inside the clipped root, and the Carousel ring is drawn by the shared focus-owner overlay keyed on the scroller, which resolves the earlier finding. In Chromium the Carousel ring paints on all four edges (default, full-height cards at rest and mid-scroll, right-to-left), a mouse hand-off still shows no ring, and the new Chromium spec passes against this head.
Non-blocking:
Carousel.tsx:44still importsfocusVars, which is now unused.- The spec's
@pr-a11y scope(CarouselFocusRing.a11y.chromium.spec.ts:2) does not nameprivateAttributes/focusOwner, so a change to the overlay alone would not run it. - Two new comments could be shorter (
focusOwner.stylex.ts:48-52,CodeBlock.tsx:1254-1255). - Miss: the CodeBlock ring's two bottom corners are clipped by the root's rounded corners; the edges paint whole.
[Automated review]
| // The same ring, drawn as an overlay pseudo-element above the wrapper's | ||
| // content and inset by the ring's width, for a marked control whose own | ||
| // painting would cover a ring on the wrapper: a scroller with an edge-fade | ||
| // mask is its own stacking context. The wrapper must be positioned and must | ||
| // not use ::after. |
There was a problem hiding this comment.
Non-blocking: the first sentence is 43 words and carries several topics. A shorter version that keeps the reason: "The same ring on an overlay above the wrapper's content, inset by its width. Use it when the marked control covers a ring on the wrapper: an edge-fade mask makes a scroller its own stacking context. The wrapper must be positioned and must not use ::after."
| // The root clips (overflow: hidden, for its corners), so the viewport's | ||
| // keyboard ring sits inside its own box instead of around it. | ||
| viewportFocusRingInset: { | ||
| outlineOffset: { | ||
| default: null, | ||
| ':focus-visible': `calc(-1 * ${focusVars['--focus-outline-width']})`, | ||
| }, | ||
| }, |
There was a problem hiding this comment.
Non-blocking: in Chromium this ring's two bottom corners are clipped on a diagonal by the root's rounded corners (--radius-element), about 4 to 5 px of each leg on Diff Long Lines; the edges paint whole. Rounding the viewport's bottom corners to match the root would let the outline follow the curve.
There was a problem hiding this comment.
Changes requested, for one description fix: the code side is ready. Both rings now come from the theme's focus tokens, the Carousel ring paints on every edge in Chromium, and the new tests and Chromium spec pass on this head.
- Miss: this pull request changes
architecture:interaction-modalityINV1, but the## Writing rubric resultssection of the description is empty; add one line per rubric item (R1 to R6 indocs/contributing/spec-writing.md), asdocs/architecture/knowledge-contracts.mdrequires for every record change.
Editing the description adds no commit, so the spec approval for this head still holds. The earlier non-blocking notes still stand (the unused focusVars import, the spec's @pr-a11y scope, two long comments, the CodeBlock ring's bottom corners), and the header of focusOwner.stylex.ts should also name the new export.
[Automated review]
| focus indicator; after keyboard input it does. A wrapper whose content would | ||
| cover a ring it draws, such as a masked scroller that is its own stacking | ||
| context, draws the shared ring as the focus-owner overlay | ||
| (`focusWithinOwnerOverlay` in `privateAttributes/focusOwner.stylex.ts`), keyed | ||
| on the owner attribute as INV3 says. |
There was a problem hiding this comment.
This record change needs its writing-rubric results in the pull request description: one line per item, R1 to R6 of docs/contributing/spec-writing.md, under ## Writing rubric results, as docs/architecture/knowledge-contracts.md asks of every record change. The heading is there but empty. Editing the description adds no commit, so the spec approval for this head still holds.
| export const focusWithinOwner = styles.focusWithinOwner; | ||
|
|
||
| /** The wrapper's focus ring, drawn above the wrapper's content. */ | ||
| export const focusWithinOwnerOverlay = styles.focusWithinOwnerOverlay; |
There was a problem hiding this comment.
Non-blocking: the file header's @output (lines 6-7) still lists only focusWithinOwner and focusOwnerProps. Add this export there so the header stays accurate.
There was a problem hiding this comment.
Approved. The description now reports the writing-rubric results for the INV1 change, which was the one remaining item. Both rings come from the theme's focus tokens: the CodeBlock viewport's ring sits inside the clipped root, and the Carousel ring paints on every edge at rest and mid-scroll, while pointer focus stays ringless.
The earlier non-blocking notes still stand and can go in a follow-up: the unused focusVars import in Carousel.tsx, the Chromium spec's @pr-a11y scope (add privateAttributes/focusOwner), the focusOwner.stylex.ts header and two long comments, the CodeBlock ring's thinned bottom corners, and the unused expectSharedFocusRing test helper.
[Automated review]
| ); | ||
|
|
||
| /** The element draws the shared ring at the token offset. */ | ||
| export function expectSharedFocusRing(el: Element): void { |
There was a problem hiding this comment.
Non-blocking: nothing imports expectSharedFocusRing (SideNav.test.tsx keeps its own local copy of the same check). Delete it here, or have SideNav import it, so the shared-ring assertion lives in one place.
Part of #8852 (CodeBlock and Carousel; Table is #8873, ChatMessageList, Tooltip and HoverCard follow)
User impact
A keyboard user who tabs into an overflowing
CodeBlockor into aCarouselgets the browser's default focus ring instead of the theme's. It has its own colour, width and style and looks different in each browser. On an overflowing carousel the scroller's edge-fade mask fades the ring on its faded side. After this change both draw the same theme-driven ring as every other Astryx control, whole, inside the component.Problem and solution fit
--focus-outline-*tokens are how Astryx draws one.CodeBlock's root clips its corners (overflow: hidden), and the carousel root clips with a 1px margin.Both compose the shared ring, inset by its own width so it stays inside the clip. That's the same inset the Table scroll wrapper and
ChatToolCallsuse.Expected behavior and authority
architecture:interaction-modalitynamesutils/focusOutline.stylex.tsand the focus tokens as the shared focus-indicator mechanics and theme seam.Smallest restoration
CodeBlock.tsx: the viewport composesfocusOutlineProps.focusVisibleplus an inset offset. The collapse toggle already had the shared ring.Carousel.tsx: the scroller is the focus owner (focusOwnerProps) and paints no ring of its own (focusOutlineStyles.suppressed). The root takesfocusWithinOwnerOverlayfromprivateAttributes/focusOwner.stylex.ts: the shared ring drawn as a::afteroverlay above the root's content and inset by the ring's width, keyed on the owner attribute (architecture:interaction-modalityINV3). The overlay is needed because the scroller's edge-fade mask would erase a ring the scroller painted, and it makes the scroller a stacking context that covers a ring the root painted. INV1 names the overlay for wrappers whose content would cover their ring.__tests__/insetFocusRing.ts: a small test helper asserting the shared ring, plain or inset, by its compiled atoms.Evidence
Real Chrome 156 (headless, DPR 2), Storybook from
mainand from this branch. Focus was reached by real Tab presses. Computed outline, and the painted ring against the clipping root (itsoverflow-clip-marginincluded):mainauto 1pxUA ringsolid 2pxtheme colour, offset-2px; whole inside the rootauto 1pxUA ring; faded on the inline-end side by the edge-fade masksolid 2pxtheme colour, inset-2pxon the root's overlay; every edge paintedCodeBlock.focusRing.test.tsxandCarousel.focusRing.test.tsx, both failing onmain. jsdom doesn't match:focus-visible, so they pin the composition; the browser check above covers the geometry.Scope
Testing
pnpm vitest runfor CodeBlock and Carousel: 198 pass, with the new tests failing first.tsc --noEmitfor core, eslint, prettier.Chromium evidence
CarouselFocusRing.a11y.chromium.spec.tschecks painted pixels: the midpoint of each edge of the Carousel root shows the ring colour, at rest and mid-scroll, onDefaultand on full-heightCard Content. It also checks the CodeBlock viewport ring. Against this head's exact Vercel Storybook (2858800), all 3 pass. Against main all 3 fail, because the ring is the browser'sautooutline.Writing rubric results
The record change is one sentence in
architecture:interaction-modalityINV1.