Skip to content

fix(core): a TreeList row with no action shows its keyboard focus ring - #12153

Merged
josephfarina merged 6 commits into
mainfrom
josephfarina/treelist-plain-row-focus
Nov 18, 2026
Merged

josephfarina merged 6 commits into
mainfrom
josephfarina/treelist-plain-row-focus

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A TreeList row with no action, no onClick, href or children, is still a stop in the tree's arrow-key focus, but it showed no focus ring. In a file tree built from such rows, a keyboard user moving with the arrow keys could not see which row was focused, selected or not.

Problem and solution fit

TreeListItem gave interactive rows the shared ring styles and plain rows the bare style list. Plain rows now draw the ring too, through a style in TreeListItem's own styles (plainRowFocusRing). It reads only the focus variables the row's treeitem already publishes with the shared publishFocusVisibleVars. No new module and no new export: the public focus-outline API is unchanged, and the shared module gains only a comment naming this exception. It reads only the focus variables the row's own treeitem publishes and has no focus-inside branch, so a control in the row's start or end content still rings alone. A matching publishedFocusLift lifts the focused plain row above the guides. The hover and press styles stay on interactive rows only. At rest nothing changes.

Expected behavior and authority

Every row in the roving focus shows keyboard focus (component:TreeList AR1 roving focus; DD3: a row whose focus ring is showing paints above the guides). No record change: the record never said plain rows go without a ring.

Smallest restoration

One ring style and lift in TreeListItem's own styles, one style branch, comments, two new tests, one updated test, and a changeset.

Evidence

  • New test "draws the focus ring on a plain row that has keyboard focus": ArrowDown onto a plain row publishes the focus outline, and the row composes the ring classes. It fails on main.
  • New test "does not ring a plain row when focus is on a control in its end content": Tab onto the row, then onto its Pin button; the row composes no focus-inside ring. (It passes on main, which rings no plain row; it guards this fix.)
  • The guide-lift test now expects plain rows to take their lift; it fails on main.
  • Real browser (Chromium), TreeList row-names story:
    • Tab onto the plain "Budget" row draws exactly one ring, the row's 2 px outline. Main draws none.
    • The next Tab, onto the row's Pin button, shows only the button's own ring, not the row's.
    • At rest the story is pixel-identical to main.
  • The shell-nav, canvas-editor and IDE templates are pixel-identical at rest.
  • A replay of build against main moves no start, alternative or block list.

Size

First-load JavaScript, base against head (scripts/measure-reference-pages.mjs):

  • The four reference pages (docs, form, menu, table): +0. The shared focus-outline module does not grow.
  • A page with TreeList and Text: +151 B minified, +45 B gzip, for the ring on plain rows. This is default behavior, not an optional feature.

Scope

Components: TreeList (no public API and no new module added)

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • vitest run packages/core/src/TreeList packages/core/src/hooks: pass. The ring test and the lift test fail on main; the end-content test passes on main too, and guards against a focus-inside ring on a plain row.
  • tsc --noEmit for core: clean.
  • prettier and eslint on the changed files: clean.

@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 17, 2026 1:20am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 16, 2026
@astracat-bot

astracat-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 17, 2026, 1:33 AM UTC

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · e184941

Storybook · Sandbox · built from this PR's head

Current run: The current CI run concluded cancelled. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes. The fix works: a plain TreeList row now shows the shared focus ring when it has keyboard focus, and both changed tests fail on main and pass here. One side effect needs a change before this lands.

  • A plain row now also draws its ring while keyboard focus is on a control inside its start or end content (for example the Pin button in the TreeList Row Names story), so one focus move shows two rings; key the plain row's ring and lift only on its treeitem's own published focus, through a shared variant in focusOutline.stylex.ts, and add a test that tabs into an end-content control.

Optional: the rewritten focusLift comment (TreeListItem.tsx:125-127) credits the wrong cause, since the lift's own conditions are what limit it.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claims
    • Changeset: a plain row now shows the focus ring under keyboard focus, where it showed no sign of focus before: verified (Chromium: no outline on main, a 2 px ring here).
    • A plain row is already a stop in the tree's arrow-key focus: verified (TreeListItem.tsx:710, the new test's ArrowDown step).
    • Plain rows now take the ring styles and the guide lift, while hover and press styles stay on interactive rows: verified (TreeListItem.tsx:750-759).
    • Nothing changes at rest: verified (rest frames are pixel-identical).
    • The new focus-ring test fails on main: verified (it fails at its ring-class assertion).
    • The updated guide-lift test fails on main: verified.
    • 1310 tests pass in the TreeList and hooks folders: verified.
    • Prettier and ESLint are clean on the changed files: verified.
    • No new public API, default or interaction model rides under the fix: verified (the API report lists no rows).
    • The template pixel checks and the build replay: not reproduced here; consistent with the rest-frame comparison.
  • Files
    • .changeset/treelist-plain-row-focus.md: clear.
    • packages/core/src/TreeList/TreeList.test.tsx: clear; no case covers a control inside a plain row.
    • packages/core/src/TreeList/TreeListItem.tsx: the blocking finding above, plus the optional comment note.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec bf28f11

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes. The fix works: a plain TreeList row now shows the focus ring while its treeitem has keyboard focus, and a control in its end content keeps the only ring. The /approve-spec for this head records the engineering owner's decision to ship the two new published members as public API, so what remains is a description edit.

  • focusOutlineProps.published is public at the package root, ./utils and ./utils/focusOutline.stylex but sits outside this pull request's TreeList scope, so name it on the Components: scope line.
  • focusOutlineStyles gains a public published member that also sits outside the TreeList scope, so name it on the Components: scope line too.
  • The checked box "No new public API, visual representation, default, or interaction model is hidden under the bug-fix label" is false while the fix ships those two public members, so reword it to say the shared published variant is public and list both members.
  • Please also state the first-load gzip delta on the four reference pages for the growth of the shared focus-outline module; measured here: docs +13 B, form +16 B, menu +2 B, table +11 B.
Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claims
    • Changeset: a plain row now shows the focus ring under keyboard focus and was already a stop in the arrow-key focus: verified (TreeListItem.tsx:754-764, the new ring test, Chromium).
    • On main a plain row was a roving stop with no ring, and interactive rows alone took the shared ring styles: verified (main's plain branch composes no ring; Chromium reads no outline).
    • Plain rows now ring through a new shared published variant: verified (focusOutline.stylex.ts:211-214, TreeListItem.tsx:757).
    • The variant reads only the treeitem's published focus and has no focus-inside branch, so a control in the row's start or end content rings alone: verified (end-content test; Chromium Pin focus leaves the row without an outline).
    • publishedFocusLift lifts the focused plain row above the guides: verified (z-index 2 in Chromium; the updated lift test).
    • Hover and press styles stay on interactive rows only: verified (TreeListItem.tsx:730-753).
    • Nothing changes at rest: verified (the rest frame is pixel-identical to main).
    • Every row in the roving focus shows keyboard focus, with no record change: verified (TreeList AR1 and DD3; no record in the diff).
    • Smallest restoration (one shared variant, one branch and lift, comments, two new tests, one updated test, a changeset): verified.
    • The new ring test and the updated lift test fail on main: verified.
    • The end-content test shows no focus-inside ring on the row: verified; on main it fails only because the new member is missing there.
    • In Chromium the focused Budget row draws one 2 px ring, main draws none, and Pin focus shows only the button's ring: verified (reached with ArrowDown from Documents, which holds the story's Tab stop).
    • The story and the shell-nav, canvas-editor and IDE templates are pixel-identical at rest: verified for the story; the templates follow from the row's unchanged rest values and were not captured.
    • A build replay moves no start, alternative or block list: not reproduced; this review does not rely on it.
    • One defect is restored; separable tag-alongs were removed or split; public text holds no internal context: verified.
    • No new public API is hidden under the bug-fix label: false (focusOutlineProps.published, focusOutlineStyles.published).
    • The TreeList and hooks tests pass and the three changed tests fail on main: verified (1311 tests pass).
    • Prettier and ESLint are clean on the changed files: verified.
  • Files
    • .changeset/treelist-plain-row-focus.md: clear.
    • packages/core/src/TreeList/TreeList.test.tsx: clear.
    • packages/core/src/TreeList/TreeListItem.tsx: clear.
    • packages/core/src/utils/focusOutline.stylex.ts: the two scope findings above.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 8b06d89

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec b83a20e

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes. The fix works and is now self-contained: a plain TreeList row shows the focus ring while its treeitem has keyboard focus, a control in its end content keeps the only ring, and no public API or new module is added. One description edit remains.

  • The Testing line says the three changed tests fail on main, but "does not ring a plain row when focus is on a control in its end content" passes on main (only the ring test and the lift test fail there), so say which two fail and that the end-content test guards against a focus-inside ring.

Optional: three new comments run past the repository's comment style (two 30-word sentences in TreeListItem.tsx, and the new exception in focusOutline.stylex.ts gives no reason and breaks the wrap); suggested rewrites are inline.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claims
    • Title and changeset: a TreeList row with no action (no onClick, href or children) now shows the focus ring under keyboard focus, and was already an arrow-key stop: verified (TreeListItem.tsx:760-771, the new ring test, Chromium).
    • On main a plain row was a roving stop with no ring, and only interactive rows took the shared ring styles: verified (main's plain branch composes no ring; Chromium reads no outline).
    • Plain rows ring through a style in TreeListItem's own styles: verified (TreeListItem.tsx:137-140, :764).
    • That style reads only the variables the treeitem publishes with publishFocusVisibleVars: verified (TreeListItem.tsx:724, :138-139).
    • No new module and no new export, the public focus-outline API is unchanged, and the shared module gains only a comment: verified (the API generator lists no row; focusOutline.stylex.ts:12-13 is comment only).
    • With no focus-inside branch, a control in the row's start or end content rings alone: verified (the end-content test; the Chromium Pin frame is pixel-identical to main).
    • publishedFocusLift lifts the focused plain row above the guides: verified (TreeListItem.tsx:141-143, :766; the lift test; z-index 2 in Chromium).
    • Hover and press styles stay on interactive rows only: verified (TreeListItem.tsx:736-759).
    • Nothing changes at rest: verified (the rest frame is pixel-identical to main).
    • Every roving stop shows keyboard focus, with no record change: verified (the tree's roving-focus and guide-order rules; no record in the diff).
    • Smallest restoration (one ring style and lift, one branch, comments, two new tests, one updated test, a changeset): verified.
    • The new ring test and the updated lift test fail on main: verified.
    • The end-content test tabs to the row, then to its Pin button, and finds no focus-inside ring on the row: verified.
    • In Chromium the focused Budget row draws one 2 px ring and main none, and the next Tab to Pin shows only the button's ring: verified (Budget is reached with ArrowDown from Documents, which holds the story's Tab stop).
    • The shell-nav, canvas-editor and IDE templates are pixel-identical at rest: follows from the row's unchanged rest values; not captured.
    • A build replay against main moves no start, alternative or block list: not reproduced; this review does not rely on it.
    • The four reference pages grow by +0 and the shared focus-outline module does not grow: verified (+0 on each page).
    • A page with TreeList and Text grows by +151 B minified, +45 B gzip: verified (+151 / +45).
    • One defect is restored, tag-alongs are removed, no new public API, visual representation, default or interaction model is hidden, and public text holds no internal context: verified.
    • The TreeList and hooks tests pass: verified (1311 pass). The three changed tests fail on main: false (two fail; the end-content test passes).
    • Core typecheck, Prettier and ESLint are clean on the changed files: verified.
  • Files
    • .changeset/treelist-plain-row-focus.md: clear.
    • packages/core/src/TreeList/TreeList.test.tsx: clear; the false claim is in the description.
    • packages/core/src/TreeList/TreeListItem.tsx: two optional comment rewrites.
    • packages/core/src/utils/focusOutline.stylex.ts: one optional comment rewrite.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the josephfarina/treelist-plain-row-focus branch from 4be7108 to e184941 Compare November 17, 2026 01:13
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec e184941

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI. A TreeList row with no action (no onClick, href or children) now shows the shared focus ring while its treeitem has keyboard focus and rises above the guides, a control in its start or end content keeps the only ring, and no public API is added. The description's testing claims now match the tests: the ring and lift tests fail on main, and the end-content test passes there as a guard.

CI has not run on this head yet: its admission step found no room, so build, test and typecheck were cancelled. Re-run the CI workflow so the required checks finish before merge.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claims
    • Title and changeset: a TreeList row with no action now shows the focus ring under keyboard focus, and was already an arrow-key stop: verified (TreeListItem.tsx:759-769, the new ring test, Chromium).
    • On main such a row showed no ring, selected or not: verified (main's plain branch composes no ring; the ring test's selected plain row fails there; the Chromium frame matches the rest frame).
    • Interactive rows took the shared ring styles and plain rows the bare style list: verified (main's TreeListItem.tsx:736-751).
    • Plain rows ring through plainRowFocusRing in TreeListItem's own styles: verified (TreeListItem.tsx:136-139, :762).
    • That style reads only the variables the treeitem publishes with publishFocusVisibleVars: verified (TreeListItem.tsx:723, :137-138).
    • No new module or export, the public focus-outline API is unchanged, and the shared module gains only a comment: verified (the API generator lists no row; focusOutline.stylex.ts:12-18 is comment only).
    • With no focus-inside branch, a control in the row's start or end content rings alone: verified (the end-content test; in Chromium the row stays unringed while Pin has focus).
    • publishedFocusLift lifts the focused plain row above the guides: verified (TreeListItem.tsx:140-142, :764; the lift test; z-index 2 in Chromium).
    • Hover and press styles stay on interactive rows only: verified (TreeListItem.tsx:735-737, :744-758).
    • Nothing changes at rest: verified (the rest frames are pixel-identical).
    • Every roving stop shows keyboard focus, with no record change: verified (the tree's roving-focus and guide-order rules; no record in the diff).
    • Smallest restoration (one ring style and lift, one branch, comments, two new tests, one updated test, a changeset): verified.
    • The ring test and the lift test fail on main; the end-content test passes there and guards the fix: verified (2 failed, 122 passed on main with the new tests).
    • In Chromium the focused Budget row draws one 2 px ring and main none, and the next Tab to Pin shows only the button's ring: verified (Budget is reached with ArrowDown from Documents, which holds the story's Tab stop).
    • The shell-nav, canvas-editor and IDE templates are pixel-identical at rest: not captured; follows from the row's unchanged rest values.
    • A build replay against main moves no start, alternative or block list: not reproduced; not relied on.
    • The four reference pages grow by +0 and a TreeList and Text page by +151 B minified, +45 B gzip: not re-measured; the shipped code is unchanged since the last measurement apart from comments, which minification drops.
    • One defect is restored, tag-alongs are removed, no new public API, default or interaction model is hidden, and public text holds no internal context: verified.
    • The TreeList and hooks tests pass: verified (1311 pass).
    • Core typecheck, Prettier and ESLint are clean on the changed files: verified.
  • Files
    • .changeset/treelist-plain-row-focus.md: clear.
    • packages/core/src/TreeList/TreeList.test.tsx: clear.
    • packages/core/src/TreeList/TreeListItem.tsx: clear.
    • packages/core/src/utils/focusOutline.stylex.ts: clear.

Automated review (maintainer link)

@josephfarina josephfarina reopened this Nov 17, 2026
@josephfarina josephfarina reopened this Nov 18, 2026
@josephfarina
josephfarina merged commit 56d3546 into main Nov 18, 2026
139 of 223 checks passed
@github-actions
github-actions Bot deleted the josephfarina/treelist-plain-row-focus branch November 19, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — e1849413 Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant