Repository navigation
fix(Item, Token): a control inside a row with its own action, or a token's Remove, rings itself - #8869
Conversation
… too architecture:interaction-modality INV3: one focus move has one owning indicator. Item and Token drew their ring with focusWithin (:has(:focus-visible)), which matches any focused descendant, so a control in an Item's start or end slot, or a Token's remove button, drew its own ring and the row or token drew a second around it; a row with no action of its own rang too. A new shared style, focusWithinOwner, rings a wrapper only for the direct child marked data-astryx-focus-owner (FOCUS_OWNER_ATTRIBUTE). Item marks its invisible button and link (delegation mode keeps focusWithin: the nested control is the row's sole tab stop by contract); Token marks its button and link. Other controls ring themselves. New stories (Item With End Actions, Token Clickable With Remove) and FocusRingOwner.a11y.chromium.spec.ts: one ring at every tab stop at 1280 and 390 px; it fails on main (two rings while Share or Remove is focused). focusRings.ts is a shared helper for such specs.
|
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.
The focus-ring fix works: each tab stop in the new Item and Token stories now paints one outline, as component:Token AR4 and architecture:interaction-modality INV3 require. Approval waits on one decision: focusWithinOwner and FOCUS_OWNER_ATTRIBUTE are reachable from the published @astryxdesign/core/utils and @astryxdesign/core/utils/focusOutline.stylex entry points, which makes them public API under architecture:public-component-api INV12 even though the description calls them internal, and no current spec admits them, so an engineering owner either admits them by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner) or asks for the owner condition to stay component-local in Item and Token so nothing new is exported. Independently, please fix two displaced doc comments:
apps/storybook/stories/Item.stories.tsx:/** Disabled items. */now opens the With End Actions description and leaves Disabled with none; move it back aboveexport const Disabled.packages/core/src/utils/focusOutline.stylex.ts:FOCUS_OWNER_ATTRIBUTEsits betweenFOCUS_OUTLINE_PARTSand its JSDoc, so that export loses its documentation; declare the constant above that block or afterFOCUS_OUTLINE_PARTS_NONE.
[Automated review]
…abled story's doc comment CodeBunny: focusWithinOwner and FOCUS_OWNER_ATTRIBUTE were reachable from the published @astryxdesign/core/utils and utils/focusOutline.stylex entry points, which would make them public API (public-component-api INV12). They move to src/internal/focusOwner.ts, which no entry point exports, so nothing new is published and focusOutline.stylex.ts is unchanged from main. Item.stories: '/** Disabled items. */' goes back above Disabled.
….stylex.ts The repo's focus-outline-shared lint rule allows rings only in a focusOutline.stylex file; the internal file keeps that rule and the shared tokens, and no package entry point exports it.
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Tokenizer | 103.7 kB (+232 B) · 20.3 kB CSS (+233 B) | — | — · — · — |
| MoreMenu | 106.6 kB (+253 B) · 18.8 kB CSS (+197 B) | — | — · — · — |
| DropdownMenu | 106.3 kB (+239 B) · 18.8 kB CSS (+197 B) | — | — · — · — |
29 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| ContextMenu | 119.9 kB (+191 B) · 18.7 kB CSS (+240 B) | — | — · — · — |
| DropdownMenuItem | 27.8 kB (+275 B) · 6.9 kB CSS (+156 B) | — | — · — · — |
| BreadcrumbItem | 96.3 kB (+257 B) · 13.3 kB CSS (+173 B) | — | — · — · — |
| ContextMenuItem | 35.3 kB (+275 B) · 7.1 kB CSS (+154 B) | — | — · — · — |
| DropdownMenuSubMenu | 79.3 kB (+267 B) · 10.4 kB CSS (+159 B) | — | — · — · — |
| DropdownMenuCheckboxItem | 28.6 kB (+244 B) · 7.3 kB CSS (+159 B) | — | — · — · — |
| Typeahead | 87.7 kB (+218 B) · 13.4 kB CSS (+180 B) | — | — · — · — |
| Markdown | 201.4 kB (+211 B) · 21.8 kB CSS (+184 B) | — | — · — · — |
| DropdownMenuRadioItem | 28.6 kB (+227 B) · 7.3 kB CSS (+159 B) | — | — · — · — |
| SelectorOption | 24.0 kB (+227 B) · 6.7 kB CSS (+159 B) | — | — · — · — |
| TableCell | 121.2 kB (+173 B) · 19.1 kB CSS (+207 B) | — | — · — · — |
| Table | 138.1 kB (+167 B) · 19.6 kB CSS (+207 B) | — | — · — · — |
| Token · Storybook | 29.5 kB (+199 B) · 4.9 kB CSS (+174 B) | 604 (+13) | ✓ · ✓ · — |
| TableHeaderCell | 120.8 kB (+168 B) · 18.9 kB CSS (+204 B) | — | — · — · — |
| Item · Storybook | 20.5 kB (+198 B) · 6.2 kB CSS (+161 B) | 958 (+9) | ✓ · ✓ · — |
| CheckboxListItem | 79.8 kB (+188 B) · 12.0 kB CSS (+156 B) | — | — · — · — |
| RadioListItem | 75.9 kB (+173 B) · 10.7 kB CSS (+153 B) | — | — · — · — |
| ListItem | 78.9 kB (+155 B) · 12.0 kB CSS (+156 B) | — | — · — · — |
| lab/TransferListSelector | 120.9 kB (+278 B) · 1.4 kB CSS (0) | — | — · — · — |
| lab/TransferList | 112.0 kB (+249 B) · 1.2 kB CSS (0) | — | — · — · — |
| lab/DiffViewer | 93.0 kB (+225 B) · 2.1 kB CSS (0) | — | — · — · — |
| lab/TabBarMoreList | 101.8 kB (+198 B) · 1.8 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 360.4 kB (+187 B) · 2.4 kB CSS (0) | — | — · — · — |
| lab/Comments | 367.7 kB (+178 B) · 2.5 kB CSS (0) | — | — · — · — |
| PowerSearch | 305.8 kB (+62 B) · 25.5 kB CSS (+18 B) | — | — · — · — |
| Selector | 111.9 kB (+28 B) · 18.6 kB CSS (+30 B) | — | — · — · — |
| richtext/RichTextEditorToolbar | 298.5 kB (+50 B) · 454 B CSS (0) | — | — · — · — |
| Pagination | 122.9 kB (+22 B) · 19.0 kB CSS (+22 B) | — | — · — · — |
| Carousel | 74.5 kB (−2 B) · 11.7 kB CSS (+21 B) | — | — · — · — |
Package size: @astryxdesign/core 7.58 MB packed (+878 B); no new dependencies.
Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.
Accessibility: 1 violation(s)
Accessibility Audit
Status: 1 accessibility violation(s) found — 1 serious.
Token - 1 issue(s)
- 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
- Rule:
color-contrast· Affects 2/12 stories · Learn more - WCAG: 1.4.3 (Level AA)
- Rule:
Generated by PR Enrichment workflow | View full report
Follows #8869: focusWithinOwner and FOCUS_OWNER_ATTRIBUTE now come from the unexported internal/focusOutline.stylex.ts, so nothing new is published.
… ring Follows #8869: focusWithinOwner and FOCUS_OWNER_ATTRIBUTE come from the unexported internal/focusOutline.stylex.ts (focusOwnerStyles for the two selectors' stylex.props lists), so nothing new is published.
There was a problem hiding this comment.
Requesting changes: flat Item rows and both token structures now show one focus ring per tab stop, but two regressions need fixing first.
- In a numbered list (
<List listStyle="decimal">), aListItemwithonClickorhrefnow shows no focus indicator at all, because Item wraps the marked button in its marker-column span and:has(> [data-astryx-focus-owner]:focus-visible)only matches a direct child, so please let the condition reach it and add a numbered row toFocusRingOwner.a11y.chromium.spec.ts. astryx swizzle Itemandastryx swizzle Tokennow emit an import from@astryxdesign/core/internal/focusOutline.stylex, whichpackages/core/package.jsondoes not export, so please keep the owner condition in each component's own directory or move it to an exported utility that an engineering owner admits.
[Automated review]
…and Token resolve the owner module CodeBunny on #8869: - In a numbered List, Item wraps a row's button or link in the content cell beside the marker, so the owner condition's direct-child :has() missed it and the row showed no ring. The cell now carries data-astryx-focus-owner-group, and the condition also matches an owner one level down inside such a group. A numbered story and a Chromium case check one ring for a button row and a link row. - Swizzled Item and Token import internal/focusOutline.stylex, which Core did not export. It is now a ./internal/* entry like internal/touch: reachable for Core, Lab and swizzled copies, outside the compatibility promise (architecture:public-component-api INV12).
There was a problem hiding this comment.
Requesting changes: Item rows (flat and numbered) and both token structures now show one focus ring per tab stop, but two things need fixing first.
astryx swizzle Itemandastryx swizzle Tokennow emit an import of@astryxdesign/core/internal/focusOutline.stylex, and./internal/*subpaths are reserved for Astryx's own packages and sit outside the compatibility promise, so please define the owner condition in each component's own styles fromfocusVarsand drop the new export, or have an engineering owner admit it as a public utility.- The
lintcheck fails onpackages/core/src/internal/focusOutline.stylex.ts:59(@typescript-eslint/no-unnecessary-type-assertion); dropping theas neveronstyles.focusWithinOwnerfixes it.
The inline comments cover three smaller fixes: the module's stale header, the browser spec's @pr-a11y scope line, and the changeset's wording about delegation rows.
[Automated review]
…, privateAttributes/focusOwner.stylex.ts Per architecture:interaction-modality INV3 and public-component-api INV23: the private data-astryx-focus-owner attribute, its group attribute and their selector are written once, in privateAttributes/focusOwner.stylex.ts, which exports only the shared focusWithinOwner wrapper ring and the props that set the attributes. Item and Token spread those exports and never write the attribute; TokenLink takes them through its link props without typing the name. No package entry exports the module: the ./internal/focusOutline.stylex entry and its export-sync line are gone. focus-outline-shared allows the owner module to write its ring. A source-build test checks the compiled ring sits on the wrapper, keyed to the marked control's :focus-visible, never :has(...) * on every descendant; a Chromium case checks a Token inside an Item shows one ring at each stop.
There was a problem hiding this comment.
The fix works where it applies: in the new stories, each tab stop in an Item row with its own action, a Token nested in a row, and a clickable or link Token with Remove now paints one focus ring instead of two. Approval waits on an engineering owner deciding whether packages/core/src/privateAttributes/focusOwner.stylex.ts and its private-attribute convention become the owner of the wrapper focus ring, which #9182, #9183 and #9190 propose but no current record establishes; an engineering owner records that decision by approving those records or by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Two fixes are needed either way:
astryx swizzle Itemandastryx swizzle Tokennow emit an import of@astryxdesign/core/privateAttributes/focusOwner.stylex, which Core does not export, so the swizzle copy change has to land in or before this pull request.- The changeset says no control inside an
Itemrings the row any more, but delegation rows (CheckboxListItem,RadioListItem, anyItemwithinteractiveRef) still show two rings; scope it to rows with their ownonClickorhref.
[Automated review]
…s ring themselves, not the trigger too (#8874) * fix(Item, Token): a control inside rings itself, not the row or token too architecture:interaction-modality INV3: one focus move has one owning indicator. Item and Token drew their ring with focusWithin (:has(:focus-visible)), which matches any focused descendant, so a control in an Item's start or end slot, or a Token's remove button, drew its own ring and the row or token drew a second around it; a row with no action of its own rang too. A new shared style, focusWithinOwner, rings a wrapper only for the direct child marked data-astryx-focus-owner (FOCUS_OWNER_ATTRIBUTE). Item marks its invisible button and link (delegation mode keeps focusWithin: the nested control is the row's sole tab stop by contract); Token marks its button and link. Other controls ring themselves. New stories (Item With End Actions, Token Clickable With Remove) and FocusRingOwner.a11y.chromium.spec.ts: one ring at every tab stop at 1280 and 390 px; it fails on main (two rings while Share or Remove is focused). focusRings.ts is a shared helper for such specs. * fix(ClickableCard, SelectableCard): a control inside rings itself, not the card too architecture:interaction-modality INV3: one focus move has one owning indicator. Both cards drew their ring with focusWithin, so a button in their children (which the docs allow: "Nested interactive elements work independently") drew its own ring and the card drew a second around it. Each card now uses focusWithinOwner and marks its own link, button or checkbox with FOCUS_OWNER_ATTRIBUTE. SelectableCard gains a With Nested Button story; FocusRingOwner's browser spec covers both cards at 1280 and 390 px and fails on the previous head. focusRings ignores a visually hidden control's outline (the cards' screen-reader-only primaries), which paints nothing a person sees. Stacked on #8869 (focusWithinOwner). * fix(Thumbnail, Selector, MultiSelector): a nested button rings itself, not the thumbnail or trigger too architecture:interaction-modality INV3: one focus move has one owning indicator. Thumbnail's image container and the ghost and secondary Selector and MultiSelector trigger containers rang with focusWithin, so a Thumbnail's remove button, and a trigger's clear or status button, drew their own ring and the container a second around it. Each container now uses focusWithinOwner, and the Thumbnail's Open button and each trigger button carry FOCUS_OWNER_ATTRIBUTE. FocusRingOwner's browser spec gains a Thumbnail With Remove case and ghost and secondary Clearable cases for both selectors, at 1280 and 390 px; they fail on the previous head (two rings while Remove or Clear is focused). Stacked on #8872. * fix(Item, Token): keep the focus-owner ring internal; restore the Disabled story's doc comment CodeBunny: focusWithinOwner and FOCUS_OWNER_ATTRIBUTE were reachable from the published @astryxdesign/core/utils and utils/focusOutline.stylex entry points, which would make them public API (public-component-api INV12). They move to src/internal/focusOwner.ts, which no entry point exports, so nothing new is published and focusOutline.stylex.ts is unchanged from main. Item.stories: '/** Disabled items. */' goes back above Disabled. * Merge remote-tracking branch 'origin/main' into fix/focus-ring-one-owner-item-token * fix(Item, Token): the focus-owner ring lives in internal/focusOutline.stylex.ts The repo's focus-outline-shared lint rule allows rings only in a focusOutline.stylex file; the internal file keeps that rule and the shared tokens, and no package entry point exports it. * Merge branch 'fix/focus-ring-one-owner-item-token' into fix/focus-ring-one-owner-cards * fix(ClickableCard, SelectableCard): use the internal focus-owner ring Follows #8869: focusWithinOwner and FOCUS_OWNER_ATTRIBUTE now come from the unexported internal/focusOutline.stylex.ts, so nothing new is published. * chore(ClickableCard, SelectableCard): drop the now-unused focusOutlineProps import * Merge branch 'fix/focus-ring-one-owner-cards' into fix/focus-ring-one-owner-thumbnail-selector * fix(Thumbnail, Selector, MultiSelector): use the internal focus-owner ring Follows #8869: focusWithinOwner and FOCUS_OWNER_ATTRIBUTE come from the unexported internal/focusOutline.stylex.ts (focusOwnerStyles for the two selectors' stylex.props lists), so nothing new is published. * fix(Item): a numbered row's own action keeps its ring; swizzled Item and Token resolve the owner module CodeBunny on #8869: - In a numbered List, Item wraps a row's button or link in the content cell beside the marker, so the owner condition's direct-child :has() missed it and the row showed no ring. The cell now carries data-astryx-focus-owner-group, and the condition also matches an owner one level down inside such a group. A numbered story and a Chromium case check one ring for a button row and a link row. - Swizzled Item and Token import internal/focusOutline.stylex, which Core did not export. It is now a ./internal/* entry like internal/touch: reachable for Core, Lab and swizzled copies, outside the compatibility promise (architecture:public-component-api INV12). * refactor(Item, Token): the focus-owner attribute has one owner module, privateAttributes/focusOwner.stylex.ts Per architecture:interaction-modality INV3 and public-component-api INV23: the private data-astryx-focus-owner attribute, its group attribute and their selector are written once, in privateAttributes/focusOwner.stylex.ts, which exports only the shared focusWithinOwner wrapper ring and the props that set the attributes. Item and Token spread those exports and never write the attribute; TokenLink takes them through its link props without typing the name. No package entry exports the module: the ./internal/focusOutline.stylex entry and its export-sync line are gone. focus-outline-shared allows the owner module to write its ring. A source-build test checks the compiled ring sits on the wrapper, keyed to the marked control's :focus-visible, never :has(...) * on every descendant; a Chromium case checks a Token inside an Item shows one ring at each stop. * Merge branch 'fix/focus-ring-one-owner-item-token' into fix/focus-ring-one-owner-cards * Merge branch 'fix/focus-ring-one-owner-item-token' into fix/focus-ring-one-owner-cards; the cards spread the focus-owner owner module's ring and props * Merge branch 'fix/focus-ring-one-owner-cards' into fix/focus-ring-one-owner-thumbnail-selector; Thumbnail, Selector and MultiSelector spread the focus-owner owner module's ring and props * Merge remote-tracking branch 'origin/main' into fix/focus-ring-one-owner-item-token # Conflicts: # packages/core/src/Item/Item.tsx # packages/core/src/Token/Token.tsx # packages/core/src/Token/TokenLink.tsx * Merge branch 'fix/focus-ring-one-owner-item-token' into fix/focus-ring-one-owner-cards * Merge branch 'fix/focus-ring-one-owner-cards' into fix/focus-ring-one-owner-thumbnail-selector * Merge main; this pull request now carries only the Selector part, with the focus-owner module Per the coordinator's Specs-ruled direction (interaction-modality INV3): only the Selector part is free. MultiSelector's focusOutline change is held on an owner card, so it is split out, along with the Thumbnail, Item, Token and card changes from the stack below; their files are back to main's. The pull request now carries what Selector needs on its own: the focus-owner owner module (privateAttributes/focusOwner.stylex.ts), the focus-outline-shared lint allowance for it, the source-build test, the ring helper, and the Chromium spec's Selector cases. * fix(Selector): the focus-owner module carries only its own attribute; lint-clean comments The owner module writes only data-astryx-focus-owner (one attribute per owner module); the one-level-down group attribute stays with Item's part. Comments no longer cite records. The Chromium spec imports test from the a11y-spec Playwright entry. The interaction-modality INV3 gap now names what remains: the module exists and Selector uses it. * fix(Selector): one style writes the trigger outline in each state; INV3 verification row says what remains Per review: focusWithinOwner is spread only when the pointer-restored focus suppression is off, so pointerRestoredFocus never sets the outline again on the same element. The INV3 verification row no longer says the module does not exist. The owner module's export comment no longer reads as permission to set the outline again. * Merge branch 'main' into fix/focus-ring-one-owner-thumbnail-selector * Merge branch 'main' into fix/focus-ring-one-owner-thumbnail-selector * Merge branch 'main' into fix/focus-ring-one-owner-thumbnail-selector * Merge branch 'main' into fix/focus-ring-one-owner-thumbnail-selector * Merge branch 'main' into fix/focus-ring-one-owner-thumbnail-selector
There was a problem hiding this comment.
Changes requested. The fix works where it applies: in the new stories, each tab stop in an Item row with its own action, a Token nested in a row, and a clickable or link Token with Remove now paints one focus ring instead of two. The earlier question about where the shared ring lives is settled, since main now names privateAttributes/focusOwner.stylex.ts as its owner.
- Regression: the branch no longer merges into
main, which now has its ownprivateAttributes/focusOwner.stylex.ts,FocusRingOwner.a11y.chromium.spec.tsandfocusRings.tsplus changes toItem.tsx, so please update the branch and add the Item and Token cases tomain's module and spec instead of replacing them. - Newly live check:
data-astryx-focus-owner-groupis written in the owner module ofdata-astryx-focus-owner(focusOwner.stylex.ts:28), which the private-attribute lint onmainrejects because each owner module writes only its own attribute; a value of that attribute, such asdata-astryx-focus-owner="group", would keep the numbered-row ring. - The changeset and title say no control inside an
Itemrings the row any more, but delegation rows (CheckboxListItem,RadioListItem, anyItemwithinteractiveRef) still show two rings, so please scope both to rows with their ownonClickorhref.
Updating the branch also brings main's swizzle support for owner modules, which settles the earlier swizzle import concern.
…Owner module Main now has privateAttributes/focusOwner.stylex.ts (from the Selector change), so this branch drops its own copy of the module, its build test and its ring helper, and takes main's. The module gains focusOwnerGroupProps: Item's content cell beside a list marker holds the row's own button or link one level down, and the wrapper ring reaches it there. Item and Token mark their own control with focusOwnerProps and ring through focusWithinOwner. The Item and Token browser cases join main's FocusRingOwner spec.
…d Token leave the INV3 gap
|
/approve-spec 0529a47 |
There was a problem hiding this comment.
Changes requested. Item rows and Tokens with their own button or link now key their ring to that control, so a control in a row's slot or a token's Remove rings alone, and the architecture:interaction-modality wording change is approved for this head.
data-astryx-focus-owner-groupis a second private attribute written in the focus-owner module (focusOwner.stylex.ts:27and:31), which the one-owner-module rule for private attributes forbids and the private-attribute lint rejects under CI's strict mode, so mark the cell with a value of the owner's own attribute,data-astryx-focus-owner="group", which keeps the numbered-row ring and passes the lint.- The changeset (line 5) and the title say no control inside an
Itemrings the row any more, but delegating rows (CheckboxListItem,RadioListItem, anyItemwithinteractiveRef) and reorderableListItemrows with a handle still show the row's ring beside an end-slot control's own, so please scope both to rows with their ownonClickorhref. - The description still describes an earlier state of the branch (its line counts, a lint-rule and ring-helper change, the owner module being created here and its exports, the Numbered With Actions story, the delegation reason and the swizzle merge gate), so please update it to this head.
The new browser cases have not run yet because CI skipped this draft. Two small comment rewrites are suggested inline.
Claims and files checked
- Changeset: a control in an
Item's start or end slot no longer rings the row: true for rows withonClickorhref(Item.tsx:904,:921,:1049); false for delegating rows (Item.tsx:1049) and reorderable rows with a handle (ListItem.tsx:641). - Changeset: a token's Remove no longer rings the token: verified (
Token.tsx:481,:503,:558,:583). - Changeset: a row or token rings only for its own action, and a row without one draws no ring: true except for those rows.
- Changeset: a patch for core: verified.
- The cause is the any-descendant
:has(:focus-visible)ring: verified (utils/focusOutline.stylex.ts:107-120). - The owner module is created here: false, it already exists on
main; this change adds the group props. - The owner module exports only the ring and the marker props: false, it also exports the overlay ring (
focusOwner.stylex.ts:97). - The wrapper rings only for its marked control, directly or one level down in a marked group: verified (
focusOwner.stylex.ts:30-56). - No package entry exports the module: verified (
packages/core/package.jsonunchanged). - Item's invisible button and link carry the marker, and the numbered cell spreads the group props: verified (
Item.tsx:904,:921,:1095). - Delegation keeps the old ring because its control is the row's only tab stop: the code is as stated (
Item.tsx:1049); the reason is false (Item.tsx:239-250). - Token's button and link carry the marker, with or without Remove: true with Remove (
Token.tsx:481,:583); without Remove the link is the token itself and rings itself. - Remove rings itself: verified (
Token.tsx:353). - The cited interaction-modality and public-component-api clauses are current: verified on
main. - The browser spec tabs every stop at two widths and asserts one ring, including a Token inside an Item and numbered rows: verified in code (
FocusRingOwner.a11y.chromium.spec.ts:333-374); not run. - The ring helper is new: false, it is unchanged from
main. - The compiled-CSS test checks every ring rule is keyed to the marked control: verified (
focusOwner.source-build.test.mjs:45-56). - The new stories: With End Actions and Clickable With Remove verified; Numbered With Actions is a button row and a link row, not Share and Restore rows (
Item.stories.tsx:380); With Token Action is also new. - Item, Token, List and utils suites pass: not checked.
- No public API, the shared focus-outline utility unchanged, the focus-outline lint admits the owner module: verified.
- Line counts and the lint-rule and helper changes: false (212 added, 29 deleted; no lint or helper change).
- The merge gate on the swizzle copy change: already met on
main. - Files:
focusOwner.stylex.ts(finding; comment suggestion),.changeset/focus-ring-one-owner-item-token.md(finding),Item.tsx(clear; comment suggestion),Token.tsx(clear),TokenLink.tsx(clear),interaction-modality.md(clear; its verification row goes stale),Item.stories.tsx(clear),Token.stories.tsx(clear),FocusRingOwner.a11y.chromium.spec.ts(clear),focusOwner.source-build.test.mjs(clear; update it with the fix).
…e changeset Marks Item's numbered content cell with data-astryx-focus-owner="group" instead of a second private attribute, so the owner module writes one attribute. The changeset now names only rows with their own onClick or href and Token's remove button. Comments keep their reason without a record citation.
|
/approve-spec 3f8b6ab |
There was a problem hiding this comment.
Approved pending CI: some required checks are still running on this head.
Item rows with their own button or link, and clickable or link Tokens, now ring only for that control, as the shared one-owner focus rule and Token's accessibility requirement ask. CI's Chromium spec confirms one ring at every Item and Token tab stop at desktop and phone widths, and the swizzle proof passes for the changed components.
Two optional tidy-ups, neither blocking:
- The description's rubric line names only the INV3 gap list, but the record change also adds the group-props sentence to INV3; naming it keeps the approval trail exact.
- INV3's verification row still says the Chromium spec covers Selector alone, and Token's record still lists the double ring on Remove as an implementation gap; both can be updated now that this fixes it.
Claims and files checked
Review mode: same-head; reason: none
- Changeset: a row with its own
onClickorhrefno longer rings when a start- or end-slot control takes focus: verified (Item.tsx:916,:933,:1035; Share drops from 2 rings to 1 in Chromium). - Changeset: a token's remove button no longer rings the whole token: verified (
Token.tsx:479-482,:503,:558,:583; Remove drops from 2 to 1 in the clickable and the link token). - Changeset: rows that delegate to a nested control, and reorderable rows with a handle, keep their ring: verified (
Item.tsx:1035;ListItem.tsx:650; a delegating row stays at 2). - Changeset: a patch release of core: verified.
- This is the Item and Token part of the double-ring bug; the cards follow in a stacked pull request, Thumbnail in another, and Selector is already fixed: verified.
- Before, focusing the slot control or Remove showed two rings; after, one; delegating and reorderable rows keep their current ring: verified.
- Stills: one ring at this head and two on main at desktop light and dark, phone width and forced colours, and no ring is clipped: verified at desktop light from captured frames and at desktop and phone widths by CI's spec; the dark and forced-colour stills are the author's, and the ring condition does not depend on colour scheme.
- The cause is the any-descendant ring: verified (
utils/focusOutline.stylex.ts,focusWithin). - The owner module already exists on
main; both components take its ring and mark their own button or link: verified. - A numbered row's content cell carries the same attribute with a
groupvalue, and the module gains that export and one ring branch: verified (Item.tsx:1082;focusOwner.stylex.ts:26-31). - Delegating rows keep the old ring because their nested control carries no marker: verified (
Item.tsx:1035). - Token's button and link carry the marker, and Remove rings itself: verified.
- The cited one-owner and private-attribute clauses are current, and Item and Token leave the INV3 gap list: verified.
- The group mark keeps one attribute and one owner module: verified (strict lint 0 errors; CI lint passes).
- The browser spec tabs every stop of the four stories at 1280 and 390 px and asserts one ring, and fails on
mainat Share or Remove: verified (CI passes it on this head; base frames show two rings at Share and Remove). - The compiled-CSS test keys every ring rule to the marked control, directly or through a group cell: verified, passes.
- New stories With End Actions, Numbered With Actions, With Token Action and Clickable With Remove: verified (
Item.stories.tsx:334,:367,:381;Token.stories.tsx:172). - Item, Token and focus-owner suites pass: verified.
- The record change is the INV3 gap list: incomplete; INV3 also gains the group-props sentence (
interaction-modality.md:157-160), and the rubric results hold for it. - No public API, and no package entry exports the owner module: verified (API surfaces identical; CI's API report lists no change).
- Public text carries no internal context: verified.
- Files:
privateAttributes/focusOwner.stylex.ts(clear),Item/Item.tsx(clear),Token/Token.tsx(clear),Token/TokenLink.tsx(clear),docs/architecture/interaction-modality.md(clear; verification-row note),.changeset/focus-ring-one-owner-item-token.md(clear),Item.stories.tsx(clear),Token.stories.tsx(clear),FocusRingOwner.a11y.chromium.spec.ts(clear),focusOwner.source-build.test.mjs(clear). - Review rules changed since the last review (same-head re-review, review mode line): checked: the review rules, this pull request's conversation, labels, approvals and CI on this head; no finding.
…t the card too (#8872) * fix(Item, Token): a control inside rings itself, not the row or token too architecture:interaction-modality INV3: one focus move has one owning indicator. Item and Token drew their ring with focusWithin (:has(:focus-visible)), which matches any focused descendant, so a control in an Item's start or end slot, or a Token's remove button, drew its own ring and the row or token drew a second around it; a row with no action of its own rang too. A new shared style, focusWithinOwner, rings a wrapper only for the direct child marked data-astryx-focus-owner (FOCUS_OWNER_ATTRIBUTE). Item marks its invisible button and link (delegation mode keeps focusWithin: the nested control is the row's sole tab stop by contract); Token marks its button and link. Other controls ring themselves. New stories (Item With End Actions, Token Clickable With Remove) and FocusRingOwner.a11y.chromium.spec.ts: one ring at every tab stop at 1280 and 390 px; it fails on main (two rings while Share or Remove is focused). focusRings.ts is a shared helper for such specs. * fix(ClickableCard, SelectableCard): a control inside rings itself, not the card too architecture:interaction-modality INV3: one focus move has one owning indicator. Both cards drew their ring with focusWithin, so a button in their children (which the docs allow: "Nested interactive elements work independently") drew its own ring and the card drew a second around it. Each card now uses focusWithinOwner and marks its own link, button or checkbox with FOCUS_OWNER_ATTRIBUTE. SelectableCard gains a With Nested Button story; FocusRingOwner's browser spec covers both cards at 1280 and 390 px and fails on the previous head. focusRings ignores a visually hidden control's outline (the cards' screen-reader-only primaries), which paints nothing a person sees. Stacked on #8869 (focusWithinOwner). * fix(Item, Token): keep the focus-owner ring internal; restore the Disabled story's doc comment CodeBunny: focusWithinOwner and FOCUS_OWNER_ATTRIBUTE were reachable from the published @astryxdesign/core/utils and utils/focusOutline.stylex entry points, which would make them public API (public-component-api INV12). They move to src/internal/focusOwner.ts, which no entry point exports, so nothing new is published and focusOutline.stylex.ts is unchanged from main. Item.stories: '/** Disabled items. */' goes back above Disabled. * Merge remote-tracking branch 'origin/main' into fix/focus-ring-one-owner-item-token * fix(Item, Token): the focus-owner ring lives in internal/focusOutline.stylex.ts The repo's focus-outline-shared lint rule allows rings only in a focusOutline.stylex file; the internal file keeps that rule and the shared tokens, and no package entry point exports it. * Merge branch 'fix/focus-ring-one-owner-item-token' into fix/focus-ring-one-owner-cards * fix(ClickableCard, SelectableCard): use the internal focus-owner ring Follows #8869: focusWithinOwner and FOCUS_OWNER_ATTRIBUTE now come from the unexported internal/focusOutline.stylex.ts, so nothing new is published. * chore(ClickableCard, SelectableCard): drop the now-unused focusOutlineProps import * fix(Item): a numbered row's own action keeps its ring; swizzled Item and Token resolve the owner module CodeBunny on #8869: - In a numbered List, Item wraps a row's button or link in the content cell beside the marker, so the owner condition's direct-child :has() missed it and the row showed no ring. The cell now carries data-astryx-focus-owner-group, and the condition also matches an owner one level down inside such a group. A numbered story and a Chromium case check one ring for a button row and a link row. - Swizzled Item and Token import internal/focusOutline.stylex, which Core did not export. It is now a ./internal/* entry like internal/touch: reachable for Core, Lab and swizzled copies, outside the compatibility promise (architecture:public-component-api INV12). * refactor(Item, Token): the focus-owner attribute has one owner module, privateAttributes/focusOwner.stylex.ts Per architecture:interaction-modality INV3 and public-component-api INV23: the private data-astryx-focus-owner attribute, its group attribute and their selector are written once, in privateAttributes/focusOwner.stylex.ts, which exports only the shared focusWithinOwner wrapper ring and the props that set the attributes. Item and Token spread those exports and never write the attribute; TokenLink takes them through its link props without typing the name. No package entry exports the module: the ./internal/focusOutline.stylex entry and its export-sync line are gone. focus-outline-shared allows the owner module to write its ring. A source-build test checks the compiled ring sits on the wrapper, keyed to the marked control's :focus-visible, never :has(...) * on every descendant; a Chromium case checks a Token inside an Item shows one ring at each stop. * Merge branch 'fix/focus-ring-one-owner-item-token' into fix/focus-ring-one-owner-cards * Merge branch 'fix/focus-ring-one-owner-item-token' into fix/focus-ring-one-owner-cards; the cards spread the focus-owner owner module's ring and props * Merge remote-tracking branch 'origin/main' into fix/focus-ring-one-owner-item-token # Conflicts: # packages/core/src/Item/Item.tsx # packages/core/src/Token/Token.tsx # packages/core/src/Token/TokenLink.tsx * Merge branch 'fix/focus-ring-one-owner-item-token' into fix/focus-ring-one-owner-cards * Merge main into fix/focus-ring-one-owner-item-token; use main's focusOwner module Main now has privateAttributes/focusOwner.stylex.ts (from the Selector change), so this branch drops its own copy of the module, its build test and its ring helper, and takes main's. The module gains focusOwnerGroupProps: Item's content cell beside a list marker holds the row's own button or link one level down, and the wrapper ring reaches it there. Item and Token mark their own control with focusOwnerProps and ring through focusWithinOwner. The Item and Token browser cases join main's FocusRingOwner spec. * Merge the rebuilt Item/Token branch into fix/focus-ring-one-owner-cards The branch below now sits on main and uses main's focusOwner module. The cards keep their change: ClickableCard and SelectableCard mark their own link, button or checkbox with focusOwnerProps and ring through focusWithinOwner, so a control in their children rings itself. The card cases join main's FocusRingOwner spec; main's ring helper already skips a visually hidden control. * docs(interaction-modality): name the focus-owner group props; Item and Token leave the INV3 gap * Merge fix/focus-ring-one-owner-item-token; the cards leave the INV3 gap * Merge remote-tracking branch 'origin/main' into fix/focus-ring-one-owner-item-token * fix(Item, Token): the group cell reuses the owner attribute; scope the changeset Marks Item's numbered content cell with data-astryx-focus-owner="group" instead of a second private attribute, so the owner module writes one attribute. The changeset now names only rows with their own onClick or href and Token's remove button. Comments keep their reason without a record citation. * Merge commit '3f8b6ab82afdda44e6461662604b8d6576037aa5' into l0-tmp-8872 * fix(ClickableCard, SelectableCard): comments without record citations; the records close the focus gap The two ring comments keep their reason without the record citation the comment-provenance lint rejects. Both card records now state that a nested control shows only its own indicator, drop the two-indicator gap, and list the focus-owner browser spec. * Merge remote-tracking branch 'origin/main' into fix/focus-ring-one-owner-cards # Conflicts: # docs/architecture/interaction-modality.md # packages/core/src/__tests__/FocusRingOwner.a11y.chromium.spec.ts * docs(SelectableCard): FR4 drops the nested-control focus gap this change closes FR4 still ended with the implementation-gap sentence about a focused nested control drawing two outlines, and cited a Current-state entry this change removes. The FR4 verification row now names the browser check. * Merge remote-tracking branch 'origin/main' into fix/focus-ring-one-owner-cards # Conflicts: # docs/specs/components/ClickableCard/ClickableCard.spec.md # docs/specs/components/SelectableCard/SelectableCard.spec.md * Merge remote-tracking branch 'origin/main' into fix/focus-ring-one-owner-cards FocusRingOwner's browser spec keeps main's Thumbnail case beside this branch's card cases: the scope and header name both. * Merge branch 'main' into fix/focus-ring-one-owner-cards
Part 1 of the #8850 fixes: Item and Token. ClickableCard and SelectableCard follow in #8872 (stacked on this), Thumbnail is #11613, and Selector was fixed by #8874.
User impact
Itemrow that has its ownonClickorhrefand a control instartContentorendContent(a Share button), and of aTokenwith a remove button.CheckboxListItem,RadioListItem, anyItemwithinteractiveRef) and reorderableListItemrows with a handle keep their current ring.Stills at this head
Real Chromium 149 (headed, device pixel ratio 2), keyboard focus with real Tab keys,
maine8200bb against this pull request. With focus on a row's own end-slot control or on a token's Remove,maindraws two rings (the row or token, and the control) and this head (3f8b6ab) draws one, at 1280 light and dark, at 390 px and in forced colors. With the row or token itself focused, both draw one ring. No ring is clipped.Problem and solution fit
ItemandTokenpainted their ring withfocusOutlineStyles.focusWithin, which compiles to:has(:focus-visible)and matches any focused descendant.focusWithinOwner) fromprivateAttributes/focusOwner.stylex.ts, which already exists onmain, and mark their own button or link withfocusOwnerProps.focusOwnerGroupProps, which marks it with the same private attribute (data-astryx-focus-owner="group"), so a numbered row keeps its ring. The owner module gains that export and one more branch in its ring condition. Delegating rows keepfocusWithin, because their nested control does not carry the owner marker.Current specification
architecture:interaction-modalityINV3 (current): one focus move has one owning indicator; a Core wrapper that rings for one primary control takes the shared focus-owner style and owner attribute. This pull request removes Item and Token from INV3's implementation-gap list.architecture:public-component-apiINV23 (current): each private data attribute has one owner module. The group mark reuses the owner attribute, so there is still one attribute and one owner module.Evidence
FocusRingOwner.a11y.chromium.spec.ts(real Chromium, 1280 and 390 px) tabs through every stop and asserts exactly one painted ring at each: Item › With End Actions, Item › Numbered With Actions (a button row and a link row in a decimal List), Item › With Token Action (a Token inside an Item) and Token › Clickable With Remove. Onmainit fails with two rings while Share or Remove has focus.focusOwner.source-build.test.mjscompiles the owner module and checks every ring rule is keyed to the marked control's:focus-visible, directly or through agroupcell, and never to every descendant.Writing rubric results
Record touched:
architecture:interaction-modality(the INV3 implementation-gap list).gap:line.Scope
Changeset:
[fix]patch for@astryxdesign/core, scoped to rows with their ownonClickorhrefand to Token's remove button.Owner: Astryx fix-loop lane 0. Land path: CodeBunny approval of the exact head, Specs stamp, CI, then the merge queue; #8872 merges after it.