Skip to content

fix(Text): a truncated Text is a tab stop so its tooltip opens from the keyboard - #9097

Draft
cixzhang wants to merge 18 commits into
mainfrom
fix/truncation-tooltip-keyboard
Draft

cixzhang wants to merge 18 commits into
mainfrom
fix/truncation-tooltip-keyboard

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Depends on the truncation-tooltip double-read fix (Text and Heading drop the tooltip's aria-describedby, since the full text is already in the element). Until that lands, a focused truncated Text has the same text as its name and its description, so a screen reader reads it twice. This PR merges after that fix.

Part of #8938 (the Text part). Table, Table row status, Thumbnail and ListItem have their own focus models and follow as separate pull requests.

User impact

When a Text with maxLines is cut short, its full text sits in a tooltip. That tooltip opened on mouse hover and touch only, because the text never took focus: a sighted keyboard user could not read what was cut. Now a truncated Text is a tab stop, so Tab reaches it and the full-text tooltip opens.

Real Chrome 156, built Storybook, Text › Single line truncation, pressing Tab once from the top of the page:

main this PR
Focus never reaches the text, and no tooltip appears. The text takes focus, with a focus ring, and the tooltip shows the full sentence.

A Text inside a control that already takes focus (a link, a button, a menu item, an option, a grid row or cell, a clickable card) does not become a second, unnamed tab stop inside it, and neither does a Text that holds such a control (a link or a field inside the clamped text), whose own focus opens the tooltip. A focusable region that isn't a control (AppShell's main landmark, a Drawer body, a chat log, a scrollable table viewport) doesn't count, so a Text inside one is still a tab stop. In the Button › Truncation story, no element inside a button or link gains a tab stop on either build.

Cause

component:Text FR4 (current): "A truncation tooltip can be opened from the keyboard (WCAG 2.2 2.1.1)." The record listed the gap: the tooltip anchors to an element that is not focusable, so Tooltip attaches no focus trigger.

Change

  • Text.tsx: while Text is measured as truncated with its tooltip on, it renders tabIndex={0}, which gives the existing Tooltip its focus trigger. That's the same mechanism Timestamp uses for its hover card. The stop is a prop, so it's in the DOM before the tooltip attaches its focus listeners, and a caller's own tabIndex still wins. A Text adds no stop inside a control: one that wraps it in the DOM (a link, a button, a menu item, an option, a grid row or cell), found from its ancestors when the element attaches; or a component whose own control sits beside its content and takes focus for all of it: a ClickableCard or SelectableCard (their hidden link, button or checkbox), or an interactive Item (its row, or the input a CheckboxListItem or RadioListItem delegates to). Those say so through a small internal context (TextFocusOwnerContext), which is layer-scoped: a Dialog or Popover opened from them gives its own truncated Text a tab stop. Text hidden from assistive technology (aria-hidden="true", inert) adds no stop either, and gets one when that attribute is removed (a closed Overlay or drawer opening); the tooltip then re-attaches its focus trigger (focusTrigger="always" while Text is the stop), so it opens on that focus.
  • On current main the truncation Tooltip mounts on the first hover, tap or focus (TruncationTooltip). The tab stop is what lets a keyboard focus reach that mount. TruncationTooltip passes Text's focus trigger through to Tooltip, so a stop added later (revealed content) still opens it.
  • A Text that holds a link or field takes no stop of its own; that control's focus mounts and opens the tooltip, as main already tests.
  • TextFocusOwnerContext uses the shared layer-scoped context signature.
  • Text.spec.md: FR4 states the tab stop and its exceptions for Text inside a control and Text that holds one. The implementation gap and the Current-state bullet narrow to that nested case, where focusing the control does not yet open the text's tooltip. The FR4 verification row names the new tests.
  • Text.spec.md's compatibility rows say the released default changes (a truncated Text is a tab stop) and that tabIndex={-1} keeps one Text out of the tab order.
  • A [fix] changeset names the old default (no focus), the new default (tabindex="0" while truncated) and how to restore the old one (tabIndex={-1}, or hasTruncateTooltip={false}). It's [fix] rather than [breaking] under spec:AST-017 DEC-17 because it restores the keyboard access the current FR4 contract already requires; no supported caller contract depended on cut-off text being unfocusable.

Tests

  • Text.test.tsx:
    • a truncated Text gets tabindex="0" (fails on main);
    • a truncated Text inside a link, a menuitem, a ClickableCard, a SelectableCard, a CheckboxListItem or a RadioListItem gets none; a standalone sibling, one inside a focusable main region, and one inside a container an Overlay marks as pressable all do;
    • a truncated Text in a Dialog opened from a ClickableCard gets its own stop;
    • a truncated Text in a focusable grid cell or a focusable grid row gets none;
    • truncated Text under aria-hidden or inert gets none, and gets one once both are removed;
    • a caller's tabIndex passed after the text is truncated wins.
  • After the main merge: the Text, Heading, Item, ClickableCard, SelectableCard, Button, CheckboxList, RadioList and Table suites pass (1,992 tests; one Table render-cost case timed out under machine load and passes alone). tsc, lint and the knowledge check are clean.

Writing rubric results

Run over packages/core/src/Text/Text.spec.md, the only record this PR touches:

  • R1 narration: none. The FR4 sentence, the narrowed gap and the Current-state bullet state what Text does now.
  • R2 research in the record: none.
  • R3 evidence naming a change: none. The verification cell names tests.
  • R4 rejected alternatives over one line or outside a decision: none.
  • R5 pull request or issue references remaining: none in the edited text.
  • R6 ruled open questions still listing options: none.

Owner and land path

  • Owner: Astryx maintainers, fix-loop lane 1.
  • Land path: Draft. It waits for two owner decisions: the truncation tooltip adds no description when its text is already the element's own (a separate prerequisite pull request lands first), and the FR4 tab-stop rule. Main is merged in at this head. Then code-review approval, ready for review, CI, merge.

Overlap checked: #12403 shares Text.doc.mjs and merges cleanly with this head; #12285 shares Text.spec.md and already conflicts with main.

…he keyboard

Text's truncation tooltip anchored to an element that never took focus, so
sighted keyboard users could not reveal clipped text (Text FR4, WCAG 2.1.1).
While measured as truncated with its tooltip on, Text now takes tabIndex=0,
which gives Tooltip its focus trigger; a Text inside a control that already
takes focus (link, button, menu item, option, grid row or cell) stays out
of the tab order. Text.spec.md narrows the FR4 gap and Current-state bullet
to the nested case.
@vercel

vercel Bot commented Oct 31, 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 18, 2026 9:55pm UTC

Request Review

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

astracat-bot Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Nov 18, 2026, 10:10 PM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Oct 31, 2026
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. 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.

Making a truncated Text a tab stop is the right fix for its keyboard gap, but this can't be approved yet: it rewrites the current component:Text FR4 (a tab stop, with no tab stop inside a link, button, menu item, option, or grid row or cell), so an engineering owner needs to record that decision by commenting /approve-spec b4fd31ba1ab35017db8187ff91ccee09128f7301 on this pull request, and the author may do so as an engineering owner. Whatever the decision, two fixes are needed:

  • CONTROL_SELECTOR treats any ancestor with a tabindex as a control, so a truncated Text inside AppShell's main region (tabIndex={-1}), a Drawer body or a chat log never becomes a tab stop; match only interactive elements and widget roles, and add a test for a Text inside a tabindex region.
  • The constant sits between Text's JSDoc and the function, so Text loses its doc comment; move it above the comment.

[Automated review]

Comment thread packages/core/src/Text/Text.tsx Resolved
Comment thread packages/core/src/Text/Text.tsx Resolved
The ancestor check matched any element with a tabindex, so a truncated
Text inside AppShell's main region, a Drawer body, a chat log or a
scrollable table viewport never became a tab stop. It now matches only
interactive elements and widget roles. The selector sits above Text's doc
comment so the JSDoc stays on Text. A test covers a Text inside a focusable
region.

@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.

Making a truncated Text a tab stop fixes its keyboard gap, and the latest commit resolves the earlier AppShell and doc-comment problems, but approval still waits on an engineering owner's decision on the new FR4 requirement (a tab stop, except inside a control that takes focus or acts as one item): an engineering owner records it by commenting /approve-spec 3c783767d1dd88a06eff3c41fbb1a4d6a9805ebb on this pull request, and the author may do so as one. Whatever the decision, two things need fixing:

  • A truncated title inside a ClickableCard becomes a second tab stop in the card, with the card outline and the text's own ring showing together; treat the card surface as one item (checked once the tooltip turns on, since the card marks its root in an effect) or have an owner rule otherwise, and add a test.
  • Focus on the new tab stop reads the full text twice until the separate fix that drops the tooltip's aria-describedby lands, so merge after it.

[Automated review]

Comment thread packages/core/src/Text/Text.tsx Resolved
The control check ran once on attach, before ClickableCard's passive effect
marks its surface as pressable, so a cut title inside a clickable card
became a second tab stop with two focus rings. The check now runs when the
tooltip turns on (always after mount), treats a pressable container as a
control, and sets the tab stop on the element directly; a caller's tabIndex
still wins. Text.spec.md's compatibility rows name the new tabindex.

@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.

Making a truncated Text a tab stop closes its FR4 keyboard gap, and the latest commits fix the ClickableCard double stop and the stale compatibility rows, but approval waits on an engineering owner's decision on the new FR4 requirement (a tab stop, except inside a control that takes focus or acts as one item): an engineering owner records it by commenting /approve-spec 3467d57337003f585448902f2481a559383f9be3 on this pull request, and the author may do so as one. Whatever the decision, these need fixing:

  • Because the tab stop is now written in a passive effect, a Text truncated after the tooltip module has loaded becomes a tab stop whose tooltip never opens, since Tooltip attaches first and sees an unfocusable element; rendering tabIndex from state, with the tooltip mounted after the check, fixes it.
  • The effect's cleanup removes a tabIndex the caller passes after truncation, and an as change leaves the new element without a tab stop.
  • [data-pressable-container] also matches every Overlay, so a cut caption in a non-interactive Overlay gets no tab stop.

[Automated review]

Comment thread packages/core/src/Text/Text.tsx Resolved
Comment thread packages/core/src/Text/Text.tsx Resolved
Comment thread packages/core/src/Text/Text.tsx Resolved
… says so by context

- The tab stop renders as tabIndex, so it is in the DOM before the
  tooltip attaches its focus trigger (an imperative attribute set after
  the tooltip's layout effect left it with no focus listeners when the
  tooltip module was already loaded), and a caller's tabIndex passed
  later still wins.
- ClickableCard provides TextFocusOwnerContext around its content: its
  hidden control takes focus for the whole card, so a truncated title
  adds no second stop. Text no longer reads the pressable-container
  marker, which non-interactive Overlays also carry.
- Tests: a caller tabIndex after truncation, a marked overlay keeps the
  stop, a real ClickableCard adds none.

@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.

Making a truncated Text a tab stop now opens its tooltip from the keyboard on every timing path, and the latest commit fixes the passive-effect, late-tabIndex and Overlay problems, but approval still waits on an engineering owner's decision on the new FR4 requirement (a tab stop, except inside a control that takes focus or acts as one item): an engineering owner records it by commenting /approve-spec 94dc0b366083ff16f2bf334b255bbd22088c0dc7 on this pull request, and the author may do so as one. Whatever the decision, these need fixing:

  • A cut Text inside a SelectableCard, CheckboxListItem or RadioListItem now becomes a second tab stop, because their hidden checkbox or radio sits beside the content rather than around it; providing TextFocusOwnerContext from those components too, with a nested-control test for each, keeps one stop per item.
  • The record says no default changed (Text.spec.md lines 40 and 55) while the changeset names a new default; make the two agree.

[Automated review]

…ncated Text too

SelectableCard (its hidden checkbox) and every interactive Item (its row,
or the delegate input CheckboxListItem and RadioListItem pass as
interactiveRef) provide TextFocusOwnerContext, so a truncated Text in a
card, a checkbox option or a radio option adds no second tab stop
(CheckboxListItem FR1, RadioListItem FR4). A non-interactive Item leaves
the surrounding value alone. The truncation tests find the Text element
itself, since the mounted tooltip repeats its text.

@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.

Making a truncated Text a tab stop opens its tooltip from the keyboard, and the latest commit keeps one stop per SelectableCard, CheckboxListItem and RadioListItem, but approval still waits on an engineering owner's decision on the new FR4 requirement (a tab stop, except inside a control that takes focus or acts as one item): an engineering owner records it by commenting /approve-spec cd899e7be33e696199663a72614dc3f801df0720 on this pull request, and the author may do so as one. Whatever the decision, these need fixing:

  • MaybeTextFocusOwner in Item.tsx fails the lint check (promise-function-async) and remounts a row's content whenever onClick, href or interactiveRef changes; rendering the provider unconditionally with value={isInteractive || inherited} fixes both.
  • A cut Text inside a Dialog or Popover opened from an interactive row or card gets no tab stop because the context reaches the overlay; reset it at overlay roots and add a test.
  • The record says no default changed (Text.spec.md lines 40 and 55) while the changeset names a new default; make the two agree.

[Automated review]

Comment thread packages/core/src/Item/Item.tsx Resolved
Comment thread packages/core/src/Text/Text.spec.md Resolved
…des it; the record says the default changed

- TextFocusOwnerContext is layer-scoped, so a Dialog, Popover or other
  layer opened from a card or an interactive row gives its truncated Text
  its own tab stops.
- Item renders the provider unconditionally (its value or the inherited
  one), so adding or removing onClick, href or interactiveRef no longer
  remounts the row's content, and strict lint passes.
- Text.spec.md's compatibility rows say the released default changes
  (a truncated Text is a tab stop) and that tabIndex={-1} keeps the old
  behavior, matching the changeset.

@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.

Making a truncated Text a tab stop opens its tooltip from the keyboard, and the latest commit fixes the Item lint and remount problems and gives a Dialog or Popover opened from a card or row its own stops, but approval still waits on an engineering owner's decision on the new FR4 requirement (a tab stop, except inside a control that takes focus or acts as one item): an engineering owner records it by commenting /approve-spec 88eaf7cf208d729d7b3b110fc963fc846ccadba6 on this pull request, and the author may do so as one. Whatever the decision, these need attention:

  • Text.spec.md line 57 still says "no public prop, default, or styling change" (and Builder impact says "None") while line 55 and the changeset say the default tab order changes.
  • The header and SYNC: list in TextFocusOwnerContext.ts name only ClickableCard, though Item and SelectableCard provide it too.
  • Merge after the fix that stops the tooltip describing Text; main still sets that aria-describedby.

For the decision: each cut cell in a textOverflow="truncate" Table becomes its own tab stop, and the focused text shows the browser's default focus ring rather than the shared outline.

[Automated review]

Comment thread packages/core/src/Text/Text.spec.md Resolved

@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.

Making a truncated Text a tab stop closes the keyboard gap that component:Text FR4 names, and CI checks pass. Approval waits on an engineering owner's decision on the new FR4 requirement (a truncated Text is a tab stop unless it sits inside a control that takes focus or acts as one item), recorded by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner, and rejecting it keeps FR4's current text. Independently of that decision, one fix is needed:

  • A truncated Text inside an aria-hidden="true" subtree still becomes a tab stop (Text.tsx 327–333), so keyboard focus can land on hidden content, as in Lab EmojiPicker's preview footer at narrow widths; skip the stop there and add a test.
  • Consider noting keyboard focus and the tabIndex={-1} opt-out in the maxLines and hasTruncateTooltip rows of Text.doc.mjs.
  • Merge after the fix that stops the truncation tooltip from describing Text, which is not on main yet.

[Automated review]

Comment thread packages/core/src/Text/Text.tsx Resolved
…b stop

A truncated Text inside (or itself carrying) aria-hidden="true" or inert
takes no tabindex, so keyboard focus never lands on content a screen
reader cannot perceive (Lab EmojiPicker's preview footer at narrow
widths). Test beside the control cases.

@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.

Making a truncated Text a tab stop closes the keyboard gap that component:Text FR4 names, and the latest commit keeps focus out of aria-hidden and inert content. Approval waits on an engineering owner's decision on the new FR4 requirement (a truncated Text is a tab stop unless it sits inside a control that takes focus or acts as one item), recorded by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner, and rejecting it keeps FR4's current text. Independently of that decision:

  • The hidden-content check runs only when the Text attaches (Text.tsx 332–339), so a cut Text that mounts inside a closed controlled Overlay or a collapsed ChatComposerDrawer stays out of the tab order after it opens; re-run the check when that ancestor's aria-hidden or inert changes, with a test that removes it after mount.
  • Consider noting keyboard focus and the tabIndex={-1} opt-out in the maxLines and hasTruncateTooltip rows of Text.doc.mjs.
  • Merge after the fix that stops the truncation tooltip from describing Text, and take main into the branch so the build-storybook story-tree check, which passes on main, runs on current story titles.

[Automated review]

Comment thread packages/core/src/Text/Text.tsx Resolved
The hidden check ran only when the Text attached, so a truncated caption
mounted under a closed Overlay's inert scrim or a collapsed drawer stayed
without a stop after it opened. Text now watches each aria-hidden or
inert ancestor it found and re-checks when that attribute changes; a test
removes both after mount.

@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.

Making a truncated Text a tab stop closes the keyboard gap that component:Text FR4 names, and the latest commit gives cut text revealed after mount its stop back. Approval waits on an engineering owner's decision on the new FR4 requirement (a truncated Text is a tab stop unless it sits inside a control that takes focus or acts as one item), recorded by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner, and rejecting it keeps FR4's current text. Independently of that decision:

  • A cut Text that is measured while hidden and revealed later (a controlled Overlay that opens, for one) now takes focus but never opens its tooltip, because Tooltip attached its focus trigger while the text was unfocusable (useTooltip.tsx 507–515); re-attach it when the stop appears, for example with focusTrigger={isTabStop ? 'always' : 'auto'}, and have the test at Text.test.tsx 553 focus the text and expect its tooltip.
  • Consider noting keyboard focus and the tabIndex={-1} opt-out in the maxLines and hasTruncateTooltip rows of Text.doc.mjs.
  • Merge after the fix that stops the truncation tooltip from describing Text, which is not on main yet.

[Automated review]

Comment thread packages/core/src/Text/Text.tsx Resolved
Comment thread packages/core/src/Text/Text.test.tsx Resolved
…cus trigger

useTooltip decides once, when it attaches, whether to listen for focus,
so a revealed Text took focus but never opened its tooltip. Text passes
focusTrigger 'always' while it is the tab stop (and no caller tabIndex
decides), which re-attaches the trigger with focus listeners. The test
focuses the revealed text and waits for its tooltip to open.

@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.

Making a truncated Text a tab stop closes the keyboard gap that component:Text FR4 names, and the latest commit makes cut text revealed after mount open its tooltip on focus. Approval waits on an engineering owner's decision on the new FR4 requirement (a truncated Text is a tab stop unless it sits inside a control that takes focus or acts as one item), recorded by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner, and rejecting it keeps FR4's current text. Independently of that decision:

  • Consider noting keyboard focus and the tabIndex={-1} opt-out in the maxLines and hasTruncateTooltip rows of Text.doc.mjs.
  • Merge after the fix that stops the truncation tooltip from describing Text, which is not on main yet.

[Automated review]

@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.

Making a truncated Text a tab stop closes the keyboard gap that component:Text FR4 names, and the latest commit updates the maxLines and hasTruncateTooltip docs to say the tooltip opens on keyboard focus. Approval waits on an engineering owner's decision on the new FR4 requirement (a truncated Text is a tab stop unless it sits inside a control that takes focus or acts as one item), recorded by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner, and rejecting it keeps FR4's current text. Independently of that decision:

  • Consider naming the in-control exception and the tabIndex={-1} opt-out in the maxLines row of Text.doc.mjs.
  • Merge after the fix that stops the truncation tooltip from describing Text, which is not on main yet.

[Automated review]

Comment thread packages/core/src/Text/Text.doc.mjs Resolved
…n-control exception

Text's record moved to docs/specs/components/Text; FR3's reflow claim
and its verification row come from main, FR4's tab stop and its row
from this branch, and the compatibility lines carry both changes. Item
keeps main's clickable-container proxy and ListRow context inside the
focus-owner context. The maxLines doc names the in-control exception and
the tabIndex={-1} opt-out, per review.
…abIndex={-1} opt-out

Per review. (Meant for the previous commit.)

@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.

Making a truncated Text a tab stop closes the keyboard gap that component:Text FR4 names, and the new tests fail before this change and pass after it. Approval waits on an engineering owner's decision on the new FR4 requirement: a truncated Text is a tab stop unless it sits inside a control that takes focus or acts as one item. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner; rejecting it keeps FR4's current text.

Blocking:

  • Miss: CONTROL_SELECTOR in packages/core/src/Text/Text.tsx (225–247) hand-rolls a second list of interactive controls beside the shared INTERACTIVE_SELECTORS and innermostInteractive in packages/core/src/hooks/useClickableContainer.ts, so extend that owner with a focus-owner predicate (without the pressable-container marker, plus the composite-item roles) and call it once from Text.

Please also merge only after the fix that stops the tooltip describing Text, or a focused cut Text is read twice.

[Automated review]

Comment on lines +225 to +247
const CONTROL_SELECTOR = [
'a[href]',
'area[href]',
'button',
'input',
'select',
'textarea',
'summary',
'[contenteditable]:not([contenteditable="false"])',
'[role="button"]',
'[role="link"]',
'[role="menuitem"]',
'[role="menuitemcheckbox"]',
'[role="menuitemradio"]',
'[role="option"]',
'[role="tab"]',
'[role="treeitem"]',
'[role="gridcell"]',
'[role="row"]',
'[role="switch"]',
'[role="checkbox"]',
'[role="radio"]',
].join(', ');

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.

This is a second hand-rolled list of interactive controls. hooks/useClickableContainer.ts already owns that concern: INTERACTIVE_SELECTORS (50–69) is documented as the one definition other focus and interaction utilities share "rather than hand-rolling divergent lists", and innermostInteractive (91) takes a custom predicate. The two lists share 12 entries and already differ (row, gridcell, treeitem, menuitemcheckbox, menuitemradio, summary and contenteditable here; combobox, listbox, slider, spinbutton and the pressable marker there), so a role fixed in one misses the other. Suggest adding a focus-owner predicate to the shared owner (its list without the pressable marker, plus the composite-item roles) and calling innermostInteractive once here.

Comment thread packages/core/src/Text/Text.tsx Resolved
Comment thread packages/core/src/Text/Text.tsx Resolved
main's truncation tooltip now mounts on the first hover, tap or focus.
The Text stays a tab stop, so keyboard focus mounts and opens it; the
focus trigger passes through TruncationTooltip. A Text that holds a link
or field leaves the stop to it. TextFocusOwnerContext uses the shared
layer-scoped context signature. Item keeps main's row contexts inside
TextFocusOwnerContext. The Text record combines both sides' rows.

@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.

Changes requested. Making a truncated Text a tab stop closes the keyboard gap that the current component:Text FR4 names, and the tests and a real-browser Tab check confirm it for a standalone Text. Approval also waits on an engineering owner's decision on the FR4 rewrite (the tab stop, its exceptions for Text inside or holding a control, and the changed default tab order), which an engineering owner records by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner. The new grid cell and row test passes, and the five points below still stand from the previous review.

  • Newly live check: packages/core/src/Text/TextFocusOwnerContext.ts is a new internal shared module that ClickableCard, Item and SelectableCard import and no current record names, so for an owner API decision it needs its usage, why it is needed, and why the existing pressable-container marker or focus-owner attribute is not enough.
  • The new FR4 clause "or holds such a control ... which then takes the focus and opens the tooltip" (Text.spec.md 128) does not match the code, because a Tab to a link inside a cut Text mounts the tooltip but opens nothing (this pull request's own text-field test asserts the same), so either list that case in the implementation gap or make it open.
  • Regression: the Current-state bullet (Text.spec.md 75–80) says keyboard users cannot reveal cut text inside "a button", but the current component:Button FR18 already shows a cut label in full on keyboard focus, so drop "a button" or name Button FR18 and TableHeaderCell FR2.
  • CONTROL_SELECTOR (Text.tsx 219–241) is a second hand-rolled list of interactive controls beside INTERACTIVE_SELECTORS and innermostInteractive in hooks/useClickableContainer.ts, so extend that shared owner with a focus-owner predicate and call it here.
  • Newly live check: the focusTrigger switch and its comment (Text.tsx 446–448, TruncationTooltip.tsx 182–203) assume the tooltip decides about focus when it attaches, but useTooltip decides auto when focus arrives and all 60 Text tests pass with the switch forced to 'auto', so drop the switch, the new prop, the comment and the two description sentences that describe it.
  • Non-blocking: the grid test's "In a focusable row" case (Text.test.tsx 477–483) still passes with [role="row"] removed from CONTROL_SELECTOR, because its Text sits in a gridcell; place the Text directly in the row or in a rowheader cell to pin that entry.
Claims and files checked

Review mode: incremental; reason: none

  • Claim, a cut Text with its tooltip renders tabindex 0 and a caller's tabIndex wins: verified (Text.tsx 363–364, 415; tests).
  • Claim, it uses the same mechanism as Timestamp's hover card: verified (Timestamp.tsx 497–498).
  • Claim, the stop is a prop, so it is in the DOM before the tooltip attaches: verified (Text.tsx 415).
  • Claim, no stop inside a wrapping link, button, menu item, option, grid row or cell: verified (tests, the new grid test included).
  • Claim, no stop inside ClickableCard, SelectableCard, CheckboxListItem, RadioListItem or an interactive Item, through a layer-scoped context, and a Dialog opened from a card gets its own stop: verified (tests).
  • Claim, hidden content gets no stop until revealed, and then opens its tooltip on focus: verified (test).
  • Claim, a focusable region that is not a control still gets a stop: verified (test).
  • Claim, the tooltip re-attaches its focus trigger, and the TruncationTooltip pass-through is what lets revealed text open it: false (finding above).
  • Claim, a Text that holds a link or field opens its tooltip on that control's focus, as main already tests: false (finding above).
  • Claim, the patch classification follows the compatibility clause it cites: right classification, but spec:AST-017 FR53 is the specific clause.
  • Claim, the writing rubric ran over the Text record: verified, though the description names the record's old path.
  • Claim, no element inside a button or link in the Button truncation story gains a stop: verified (the label is a plain span).
  • Claim, real Chrome shows no focus on main and a focused text with its tooltip with this change: verified in Chromium.
  • Claim, tsc, lint and the knowledge check are clean: verified at this head.
  • Claim, the named suites pass (1,992 tests): the Text, Item, ClickableCard, SelectableCard, CheckboxList, RadioList, Tooltip, Heading and Button suites pass (1,204 tests); Table was not run.
  • Claim, the double-read fix is a separate prerequisite: verified that it is not on main.
  • Claim, overlap with two other pull requests: not checked (not material to the verdict).
  • Changeset, old default, new default, the in-control exception and both opt-outs: verified (tests and code).
  • File .changeset/text-truncation-tab-stop.md: clear.
  • File docs/specs/components/Text/Text.spec.md: FR4 clause and Current-state findings, plus the owner decision.
  • File packages/core/src/ClickableCard/ClickableCard.tsx: imports the new module (finding above), otherwise clear.
  • File packages/core/src/Item/Item.tsx: imports the new module, otherwise clear.
  • File packages/core/src/SelectableCard/SelectableCard.tsx: imports the new module, otherwise clear.
  • File packages/core/src/Text/Text.doc.mjs: clear.
  • File packages/core/src/Text/Text.test.tsx: the grid row case does not pin its entry (non-blocking), otherwise clear.
  • File packages/core/src/Text/Text.tsx: control-list and focusTrigger findings, plus a long comment and a JSDoc to trim.
  • File packages/core/src/Text/TextFocusOwnerContext.ts: new-module finding.
  • File packages/core/src/Text/TruncationTooltip.tsx: focusTrigger finding.

Automated review (maintainer link)

* layer opened from such a component starts again at false, so its content
* gets its own tab stops.
*/
export const TextFocusOwnerContext = createLayerScopedContext(

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.

This is a new internal module that ClickableCard, Item and SelectableCard import, and no current record names it (architecture:knowledge-contracts DEC-22). For an owner API decision it needs its usage, why it is needed, and why the existing pressable-container marker in hooks/useClickableContainer.ts or the private focus-owner attribute is not enough.

| FR1 | Text renders one element chosen by `as` (default `span`) carrying the `text` target, which reflects `type`, `size`, and the resolved `color`. | Current source and tests |
| FR2 | A built-in `type` applies its size, line height, and default weight; a theme-added type applies the body baseline. `size` overrides the type's size while keeping its other properties; `weight` overrides the type's default weight. The resolved color is `color`, else the type's default; a theme-added color applies the primary baseline. | Current source and tests |
| FR3 | `hasCapsize` renders `block` and trims to cap height; otherwise `maxLines` above 1 renders the line-clamp box, `maxLines={1}` renders `block`, and otherwise `display` (default `inline`) applies. `justify` uses logical values; `start`, the default, sets no alignment, so the element follows its container's. `textWrap`, `hasStrikethrough`, and `hasTabularNumbers` apply their text treatments. Without truncation, a token longer than its line wraps, so in ordinary flow the text does not force horizontal scrolling at 320 CSS px (`spec:AST-020` FR1, WCAG 2.2 1.4.10 Reflow). The element's `overflow-wrap` is `break-word`, which keeps min-content, so tables and auto-sized columns lay out ordinary words unchanged; inside a Core container that wraps its content with `anywhere` (CommandPaletteEmpty, Toast, FieldStatus, Banner), it is `anywhere`, as the container's own text is. A flex child needs `min-width: 0` from its container, and a caller's own container that sets `overflow-wrap: anywhere` does not reach the element's text. | Current source and tests |
| FR4 | `maxLines={1}` clips one line with an ellipsis; a larger value clamps to that many lines unless `hasCapsize` is set, whose `block` display removes the clamp. With truncation, `wordBreak` defaults to `break-all` for one line and `break-word` otherwise. When the text is measured as truncated and `hasTruncateTooltip` is not `false`, a lazily loaded Tooltip anchored to the element shows the full text at the given placement (default `above`), and Text adds no native `title`. `hasTruncateTooltip={false}` takes no measurement. A truncation tooltip can be opened from the keyboard (WCAG 2.2 2.1.1). A truncated Text with its tooltip is a tab stop unless it sits inside a control that takes focus or acts as one item, such as a link, a button, a menu item, an option, or a grid row or cell, or holds such a control, such as a link or a field, which then takes the focus and opens the tooltip. Implementation gap: inside such a control the tooltip opens on hover and touch only (Current-state impact). Truncation re-measures when the content changes without a resize. | Current source and tests |

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.

"or holds such a control, such as a link or a field, which then takes the focus and opens the tooltip" does not match the code: a Tab to a link inside a cut Text mounts the tooltip but opens nothing, because Tooltip's auto rule ignores focus on a descendant of an unfocusable trigger (utils/triggerFocus.ts 52–63), and Text.test.tsx 1139 asserts the same for a field. Either list this case in the implementation gap and the Current-state impact, or make that focus open the tooltip and test it.

functionality to be keyboard operable. The full text stays in the DOM for
assistive technology.
- **Truncation tooltip not reachable by keyboard inside a control (FR4).** A
truncated Text inside a control that takes focus (a link, a button, a menu

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.

"a button" contradicts the current component:Button FR18: a Button already shows its cut label in full on keyboard focus, a cut Text label included. Dropping "a button", or saying that Button (FR18) and TableHeaderCell (FR2) already show their cut text on keyboard focus, keeps the bullet true.

Comment on lines +446 to +448
// The tooltip decides once, when it attaches, whether to listen
// for focus; a stop added later (revealed content) re-attaches it.
focusTrigger={isTabStop && callerTabIndex == null ? 'always' : 'auto'}

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.

useTooltip adds its focus listeners on every attach and decides auto when focus arrives (useTooltip.tsx 757–767, utils/triggerFocus.ts 52–63), and focus on the trigger itself always counts, so this switch changes nothing: all 60 Text.test.tsx cases, the reveal test included, pass with it forced to 'auto'. Suggest dropping it, the new TruncationTooltip prop and this comment, and the two description sentences that describe a re-attach.

<div role="row" tabIndex={0}>
<div role="gridcell">
<Text type="body" maxLines={1}>
In a focusable row, wider than the space it has

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.

Non-blocking: this Text sits in a gridcell, which CONTROL_SELECTOR matches by itself, so the case still passes with [role="row"] removed from the selector. Putting the Text directly in the focusable row, or in a role="rowheader" cell, makes the row entry the thing under test.

@cixzhang cixzhang removed the needs:design-review Affects visuals — Design should review label Nov 20, 2026

This branch was successfully deployed

1 active deployment
Preview — dc843c04 Deployed Nov 18, 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:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant