Skip to content

perf(Table): a default cell measures its truncation on first hover or focus - #11933

Merged
cixzhang merged 18 commits into
mainfrom
l0/table-cell-measure-on-interest
Nov 21, 2026
Merged

cixzhang merged 18 commits into
mainfrom
l0/table-cell-measure-on-interest

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

User impact

  • Who: people scrolling a Table with textOverflow="truncate" (the default with windowing), especially a wide table that windows its columns.
  • Before: each default cell measured and observed its text when it mounted, to decide whether its tooltip can show. Every column a windowed table brought in rendered its ~20 cells a second time when those measurements landed (real-Chrome profile: about 0.47 ms of each range step on a 1,000-column table).
  • After: a default cell measures on its first hover, tap or focus, which is the moment its tooltip can first show. A cut-off cell still shows its full text in a tooltip on that first hover, and a cell that fits shows none. Each later interaction measures again, so a resized column stays right.
  • Unchanged: the DOM (no new attribute), custom renderCell content, Text outside a Table's default cells, and useTruncation's public return.

What changed

  • Text/textClampContext.ts: an internal TextMeasureOnInterestContext (not exported from the package).
  • Text/useTruncation.ts: the truncation concern gains an internal mode. useTruncationMeasure (internal) takes measuresOnInterest: it measures and observes nothing at mount, measures when the tooltip interest calls its measure(), and follows content changes from the first measurement on. The public useTruncation calls it without the mode and keeps its signature and return.
  • Text/Text.tsx: inside that context, Text turns the mode on; it calls the truncation hook once and holds no measurement of its own.
  • Text/TruncationTooltip.tsx: the internal useTruncationTooltipInterest takes an optional measure callback and calls it at the interaction, so the interaction that measures the text can mount its tooltip. With measure, it starts the Tooltip module's load after the next paint without waiting for a measured truncation.
  • Table/BaseTable.tsx: default string cells in truncate mode render their Text inside the context.
  • component:Table FR2 gains one sentence, and component:Text PR1's loading clause defers to architecture:component-import-boundaries DEC-4 and names text that measures on interest; see the rubric below.
  • [perf] changeset.

Evidence

  • Red first:
    • Table.test.tsx "measures no default cell when it mounts" counts scrollWidth reads while a truncating table mounts: more than 0 on main, 0 here. The same test checks that the cell's text element carries the same attributes as a plain Text.
    • Text.test.tsx "takes no truncation measurement when it mounts" does the same check for 20 Texts.
  • Behavior: the first hover measures and opens the tooltip of truncated text; text that fits mounts no tooltip; and a later hover measures again, so text that stops fitting shows its tooltip.
  • An open tooltip follows its text (component:Text FR4): once a hover has measured a cell, a content change measures it again. Text.test.tsx "measures again when the content changes after a hover" fails on the previous head.
  • A cell that stops fitting again answers its next hover: after a resize cuts off text that a hover found fitting, the remounted tooltip reads the next hover. Text.test.tsx "opens the tooltip again when a resize cuts off text that a hover found fitting after it was open" fails on the previous head.
  • A cell whose text changed to fit and was then cut off by a resize answers its next hover: the reset compares with the rendered answer, not the last interaction's measurement. Text.test.tsx "opens the tooltip on the next hover when text that changed to fit is cut off by a resize" fails on the previous head.
  • No hover hurries the load (DEC-4): Table.test.tsx "starts no Tooltip load sooner for a hover on a cut-off cell before the page paints" holds the page's frames, hovers a cut-off cell, and finds no load until the frame runs; it fails on the previous head. A failed preload lets the next text try again.
  • First-load size (architecture:component-import-boundaries INV10; Text, its truncation hook, its tooltip interest and the Text contexts are shared): at ba80944 against main 7916ed5, measured with pnpm size:pages (the size report's esbuild options), gzip: docs +291 B, form +236 B, menu +289 B, table +230 B. The later commits change tests only. INV10's 307 B bound applies to a page that renders its component without the optional feature, which is the table page here: --unused-on table passes (+230 B). The docs, form and menu figures are reported, as INV10 asks.
  • Suites: Text, Heading, Table, Link and Lab LineClamp pass. tsc and eslint are clean.
  • Combined timing (module:Table/useTableColumnsVirtualization PR3: range ≤ 4 ms, no-op ≤ 2 ms). Setup: a local production Storybook build of a 1,000-column × 20-row column-windowed story, Chrome 149 headed, 1280 × 900, 1× CPU, dev-only instrumentation off, 300 range and 120 no-op steps per run. With fix(Table): when only its columns window, a scroll that keeps its columns commits nothing #11844, perf(Table): pinned offsets are computed once per column list, not once per cell #11893, perf(Text): a truncation measurement that finds the same result sets no state #11911 and perf(Table): a default cell measures its truncation on first hover or focus #11933 together:
Host Range p95, main Range p95, all four No-op p95, all four
First farm host 6.49–6.67 ms 3.43–3.50 ms 0.62–0.68 ms
Second farm host (about 18% slower) 7.59–8.03 ms 3.60–4.14 ms 0.72–0.99 ms
Release check's runner (4-core-ubuntu, timing gate on) — range-plus-commit p95 3.5 ms 0.1 ms

On both farm hosts the range step costs about half of main's, with one commit per range step (main: 3). On the release check's runner, which decides PR3, the four together meet it: range-plus-commit p95 3.5 ms (≤ 4) and no-op p95 0.1 ms (≤ 2), measured with the Table release proof's own scroll-to-commit probe in one gated run. The last of the four to land claims PR3.

  • Tooltip code still loads after first paint (architecture:component-import-boundaries DEC-4). Cells that measure on interest share one page-wide preload, scheduled after the page's next paint (a frame, then a task), so the first hover finds the module ready. Table.test.tsx "schedules one after-paint preload for the page, whatever the number of cells" checks that a 40-row table asks for no more frames than a 3-row one. Table.test.tsx "loads the Tooltip module after a table of default cells paints, with no interaction" counts the module's import with a fresh module registry. Only the measurement moves to the first interaction.
  • Keyboard focus: unchanged. A default cell's text holds no focusable element, so Text's focus interest never fired for it before either.

Preflight

pnpm preflight at 61dad6a (main c49f847 merged), run on a separate build machine: review:pre, build, typecheck, lint, knowledge and changesets PASS. vitest node failed only .github/scripts/lib/offline-media.test.mjs's real-browser cases, which fail the same way on main there (its network proxy; 24/24 without it). vitest ui failed one case once, Table.test.tsx "starts no Tooltip load sooner for a hover on a cut-off cell before the page paints", while that machine ran five preflights at once (load about 40): its waitFor gave up before the after-paint load landed. At this head it passes alone three times, and Table plus Text (522 tests) pass three times, also under three concurrent Table runs (939 tests each). No other failure.

Writing rubric results

Records touched: component:Table (FR2, one sentence) and component:Text (PR1).

  • R1 narration: none. The sentence states the behavior in the present tense.
  • R2 research: none.
  • R3 evidence: none in the record; the tests are named here.
  • R4 rejected alternatives: none.
  • R5 change references: none.
  • R6 open questions: none touched.
  • R7 project status: none.

Scope

  • No public API change: the context and the helper are internal.
  • Public text contains no internal context.

Overlap checked: #11911, #11105 (#11911 changes when useTruncation's setters dispatch; #11105 moves Text toward server rendering; this changes when a Table cell's Text measures)

Owner: Astryx fix-loop lane 0. Land path: real-Chrome counts, CodeBunny approval of the exact head, Specs stamp, CI, then the merge queue.

… focus

Each truncating default cell measured and observed its text when it
mounted, so every column a windowed table brought in rendered its cells
a second time. A default cell now measures on its first hover, tap or
focus, the moment its tooltip can first show, through Text's lazy
tooltip interest. Text reads the request from an internal context; the
DOM and useTruncation's return are unchanged.
@vercel

vercel Bot commented Nov 15, 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 21, 2026 4:32pm UTC

Request Review

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

astracat-bot Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 21, 2026, 5:41 PM UTC

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 15, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 2588089

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
Table 124.2 kB (+334 B) · 21.1 kB CSS (0) — ✗ · ✓ · —
TableCell 106.4 kB (+285 B) · 20.1 kB CSS (0) — ✗ · ✓ · ✓
TableHeaderCell 106.2 kB (+280 B) · 20.0 kB CSS (0) — ✗ · ✓ · ✓
114 more components
Component Size LoC Visual · A11y · RTL
TableSelectionToolbar 77.9 kB (+231 B) · 14.5 kB CSS (0) — ✗ · ✓ · ✓
TableBody 6.6 kB (0) · 3.3 kB CSS (0) — ✗ · ✓ · ✗
TableFooter 3.5 kB (0) · 3.3 kB CSS (0) — ✗ · ✓ · ✗
TableHeader 3.5 kB (0) · 3.3 kB CSS (0) — ✗ · ✓ · ✗
TableRow 7.2 kB (0) · 4.1 kB CSS (0) — ✗ · ✓ · ✗
ContextMenu 105.2 kB (+319 B) · 19.6 kB CSS (0) — — · — · —
DropdownMenu 113.3 kB (+300 B) · 19.8 kB CSS (0) — — · — · —
MoreMenu 113.6 kB (+294 B) · 19.8 kB CSS (0) — — · — · —
Heading 12.4 kB (+279 B) · 5.8 kB CSS (0) — — · — · —
lab/Comments 388.1 kB (+266 B) · 2.5 kB CSS (0) — — · — · —
Lightbox 151.1 kB (+263 B) · 12.3 kB CSS (0) — — · — · —
lab/CommentThread 381.2 kB (+262 B) · 2.4 kB CSS (0) — — · — · —
lab/Schedule 117.7 kB (+260 B) · 3.9 kB CSS (0) — — · — · —
Pagination 153.1 kB (+259 B) · 20.0 kB CSS (0) — — · — · —
TopNav 80.8 kB (+248 B) · 12.1 kB CSS (0) — — · — · —
Markdown 208.4 kB (+247 B) · 23.4 kB CSS (0) — — · — · —
Popover 104.2 kB (+243 B) · 15.5 kB CSS (0) — — · — · —
TopNavMenu 87.1 kB (+243 B) · 12.4 kB CSS (0) — — · — · —
Button 67.4 kB (+241 B) · 11.1 kB CSS (0) — — · — · —
ChatComposer 90.6 kB (+241 B) · 13.5 kB CSS (0) — — · — · —
lab/DialogHeroHeader 92.1 kB (+241 B) · 372 B CSS (0) — — · — · —
lab/TransferList 138.9 kB (+241 B) · 1.2 kB CSS (0) — — · — · —
ChatDictationButton 68.0 kB (+240 B) · 11.2 kB CSS (0) — — · — · —
ChatComposerTokenElement 87.8 kB (+239 B) · 12.5 kB CSS (0) — — · — · —
TopNavHeading 87.7 kB (+239 B) · 12.4 kB CSS (0) — — · — · —
ChatComposerInput 87.8 kB (+238 B) · 12.5 kB CSS (0) — — · — · —
MobileNav 78.9 kB (+238 B) · 11.8 kB CSS (0) — — · — · —
ChatMessageList 28.6 kB (+237 B) · 7.4 kB CSS (0) — — · — · —
ChatSendButton 67.9 kB (+236 B) · 11.1 kB CSS (0) — — · — · —
Typeahead 94.8 kB (+236 B) · 14.4 kB CSS (0) — — · — · —
ToggleButton 94.7 kB (+235 B) · 11.3 kB CSS (0) — — · — · —
lab/TransferListSelector 150.9 kB (+235 B) · 1.4 kB CSS (0) — — · — · —
DialogHeader 70.7 kB (+233 B) · 12.8 kB CSS (0) — — · — · —
IconButton 67.5 kB (+233 B) · 11.1 kB CSS (0) — — · — · —
Timestamp 27.9 kB (+233 B) · 11.4 kB CSS (0) — — · — · —
ChatLayoutScrollButton 68.0 kB (+232 B) · 11.3 kB CSS (0) — — · — · —
SideNavHeading 88.0 kB (+232 B) · 12.5 kB CSS (0) — — · — · —
SideNavItem 82.3 kB (+232 B) · 12.3 kB CSS (0) — — · — · —
richtext/RichTextEditor 310.6 kB (+231 B) · 2.7 kB CSS (0) — — · — · —
MobileNavToggle 67.8 kB (+229 B) · 11.1 kB CSS (0) — — · — · —
charts/ChartTooltip 224.2 kB (+228 B) · 451 B CSS (0) — — · — · —
DrawerHeader 70.8 kB (+225 B) · 14.3 kB CSS (0) — — · — · —
Selector 120.1 kB (+225 B) · 19.7 kB CSS (0) — — · — · —
BaseTypeahead 83.8 kB (+224 B) · 12.1 kB CSS (0) — — · — · —
FileInput 77.3 kB (+224 B) · 12.8 kB CSS (0) — — · — · —
lab/ChatReactionBar 128.8 kB (+223 B) · 1.1 kB CSS (0) — — · — · —
lab/MediaTime 223.2 kB (+223 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaTimeSlider 223.2 kB (+223 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaVolume 223.2 kB (+223 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaCaptionsButton 223.2 kB (+222 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaFullscreenButton 223.2 kB (+222 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaPlaybackRate 223.2 kB (+222 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaPlayButton 223.2 kB (+222 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaSeekButton 223.2 kB (+222 B) · 1.5 kB CSS (0) — — · — · —
AppShell 100.9 kB (+220 B) · 14.9 kB CSS (0) — — · — · —
Link 58.0 kB (+220 B) · 7.4 kB CSS (0) — — · — · —
lab/AudioPlayer 233.3 kB (+220 B) · 1.8 kB CSS (0) — — · — · —
SideNavCollapseButton 68.3 kB (+219 B) · 11.2 kB CSS (0) — — · — · —
Timer 14.0 kB (+219 B) · 6.4 kB CSS (0) — — · — · —
ChatLayout 91.1 kB (+218 B) · 11.7 kB CSS (0) — — · — · —
lab/ChatEmojiPicker 127.6 kB (+218 B) · 773 B CSS (0) — — · — · —
lab/CommentComposer 185.5 kB (+218 B) · 1.9 kB CSS (0) — — · — · —
Banner 69.5 kB (+217 B) · 11.6 kB CSS (0) — — · — · —
lab/VideoPlayer 231.0 kB (+217 B) · 2.1 kB CSS (0) — — · — · —
richtext/RichTextEditorToolbar 315.1 kB (+217 B) · 454 B CSS (0) — — · — · —
charts/Chart 247.7 kB (+216 B) · 516 B CSS (0) — — · — · —
NumberInput 106.1 kB (+216 B) · 13.0 kB CSS (0) — — · — · —
Spinner 25.1 kB (+216 B) · 6.6 kB CSS (0) — — · — · —
Stepper 69.2 kB (+216 B) · 11.3 kB CSS (0) — — · — · —
ChatToolCalls 32.9 kB (+215 B) · 8.8 kB CSS (0) — — · — · —
lab/ListInput 97.0 kB (+215 B) · 922 B CSS (0) — — · — · —
lab/TabBarMoreList 104.4 kB (+215 B) · 1.8 kB CSS (0) — — · — · —
TabMenu 84.2 kB (+214 B) · 12.3 kB CSS (0) — — · — · —
MultiSelector 108.9 kB (+213 B) · 18.9 kB CSS (0) — — · — · —
NavHeadingMenuItem 17.0 kB (+213 B) · 6.7 kB CSS (0) — — · — · —
PowerSearch 318.0 kB (+213 B) · 27.3 kB CSS (0) — — · — · —
CheckboxList 75.0 kB (+212 B) · 8.1 kB CSS (0) — — · — · —
SideNav 123.9 kB (+211 B) · 12.5 kB CSS (0) — — · — · —
charts/ChartLegend 42.0 kB (+210 B) · 224 B CSS (0) — — · — · —
Thumbnail 71.9 kB (+210 B) · 12.7 kB CSS (0) — — · — · —
Calendar 78.6 kB (+208 B) · 11.8 kB CSS (0) — — · — · —
Carousel 77.5 kB (+208 B) · 12.1 kB CSS (0) — — · — · —
Tokenizer 112.7 kB (+207 B) · 21.9 kB CSS (0) — — · — · —
Text · Storybook 11.6 kB (+205 B) · 5.8 kB CSS (0) 1,006 (+71) ✓ · ✓ · —
TextInput 101.1 kB (+205 B) · 12.8 kB CSS (0) — — · — · —
CodeBlock 83.5 kB (+204 B) · 12.9 kB CSS (0) — — · — · —
richtext/RichTextView 287.3 kB (+204 B) · 2.4 kB CSS (0) — — · — · —
AlertDialog 133.0 kB (+203 B) · 16.2 kB CSS (0) — — · — · —
DateRangeInput 106.0 kB (+203 B) · 14.2 kB CSS (0) — — · — · —
lab/EmojiPicker 120.7 kB (+203 B) · 751 B CSS (0) — — · — · —
Toast 107.2 kB (+201 B) · 11.5 kB CSS (0) — — · — · —
lab/TourStep 96.6 kB (+201 B) · 691 B CSS (0) — — · — · —
ComplexSelector 83.6 kB (+200 B) · 13.2 kB CSS (0) — — · — · —
ListItem 81.3 kB (+200 B) · 12.5 kB CSS (0) — — · — · —
TopNavMegaMenu 81.6 kB (+200 B) · 13.0 kB CSS (0) — — · — · —
Field 61.2 kB (+199 B) · 7.6 kB CSS (0) — — · — · —
CommandPalette 82.8 kB (+198 B) · 13.5 kB CSS (0) — — · — · —
Switch 111.3 kB (+198 B) · 10.4 kB CSS (0) — — · — · —
DropdownMenuSubMenu 80.5 kB (+197 B) · 11.0 kB CSS (0) — — · — · —
CommandPaletteInput 34.1 kB (+196 B) · 7.9 kB CSS (0) — — · — · —
BreadcrumbItem 102.4 kB (+195 B) · 14.0 kB CSS (0) — — · — · —
CheckboxListItem 82.2 kB (+195 B) · 12.5 kB CSS (0) — — · — · —
DateInput 208.0 kB (+194 B) · 18.9 kB CSS (0) — — · — · —
RadioListItem 78.3 kB (+191 B) · 11.1 kB CSS (0) — — · — · —
TimeInput 180.2 kB (+190 B) · 17.8 kB CSS (0) — — · — · —
lab/SelectableCardGroup 71.6 kB (+190 B) · 162 B CSS (0) — — · — · —
CheckboxInput 71.2 kB (+189 B) · 10.6 kB CSS (0) — — · — · —
lab/LineClamp 14.0 kB (+189 B) · 168 B CSS (0) — — · — · —
lab/DiffViewer 95.7 kB (+187 B) · 2.1 kB CSS (0) — — · — · —
InputGroup 63.4 kB (+183 B) · 8.8 kB CSS (0) — — · — · —
TextArea 94.8 kB (+180 B) · 10.0 kB CSS (0) — — · — · —
Slider 116.4 kB (+174 B) · 9.2 kB CSS (0) — — · — · —
RadioList 62.7 kB (+168 B) · 7.6 kB CSS (0) — — · — · —
DateTimeInput 231.9 kB (+160 B) · 20.6 kB CSS (0) — — · — · —
Visual changes: 2 snapshots in 1 component

A change is a question for the reviewer, not a failure.

Component · story Before After Diff
Table · Default (neutral, dark) · same image also changed on another pull request, not proven from main before frame after frame diff frame
Table · Default (neutral, light) · same image also changed on another pull request, not proven from main before frame after frame diff frame

Inheritance checked against the 9 newest reports of other pull requests.

Package size: @astryxdesign/core 7.96 MB packed (+2.8 kB); 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.

Text - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/24 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Generated by PR Enrichment workflow | View full report

With the measurement moved to the first hover, nothing started the
Tooltip module's after-paint load, so a table's first tooltip waited for
the code on hover. Text that measures on interest now starts that load
from the truncation tooltip's existing after-paint effect, as truncated
text does, so the first hover finds it ready.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec a74431d

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 15, 2026

@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. Measuring a default cell's truncation on interaction works and its tests are red-first, but two supporting behaviors contradict the Text record, which this pull request leaves unamended, one public doc comment is lost, and the release note has the wrong category.

  • TruncationTooltip.tsx:81 now loads the Tooltip module after first paint even when no cell is truncated (the new test at Table.test.tsx:1455 loads it once for a table whose cells fit, where main loads it zero times), which contradicts component:Text PR1 ("the Tooltip module loads only when the text is truncated"): amend PR1 for text that measures on interest, or keep the load tied to truncated text.
  • An open tooltip on a default cell keeps the old text when the cell's text changes, because the answer in Text.tsx:289-303 updates only at the next hover, tap or focus, which contradicts component:Text FR4 ("Truncation re-measures when the content changes without a resize"): measure again on a content change once the tooltip is wanted, or amend FR4 and PR1 for this mode.
  • measureTruncation was inserted between useTruncation's JSDoc and the hook (useTruncation.ts:50-81), so the published useTruncation declaration has no doc comment: move the helper above the hook's JSDoc.
  • The changeset is tagged [fix], but nothing was broken on main (a cut-off cell already showed its tooltip) and this is a performance change, so the release note should use [perf], as the repository's changeset guidance says.

An amended Text record needs an engineering owner's approval at the new head. The inline comments add three small non-blocking suggestions.

Claims and files checked

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

Claims:

  • The changeset files the change as a fix: false (nothing was broken on main; it is a performance change, finding 4).
  • A default truncating cell checks for truncation at its first hover, tap or focus instead of at mount: verified (the new Table test reads scrollWidth 9 times on main and 0 times here).
  • A wide windowed table scrolls with less work: verified as mechanism (no mount read, observer or second render per cell); timing not measured.
  • A cut-off cell still shows its full text on hover, a fitting cell shows none, and later interactions measure again: verified (Text.test.tsx:548, :578, :596).
  • Before this change, each default cell measured and observed at mount and re-rendered when the measurement landed: verified in the base useTruncation.
  • The DOM, custom renderCell content and Text outside Table's default cells are unchanged: verified (Table.test.tsx:1423, BaseTable.tsx:271-285, the context defaults to off).
  • useTruncation's public return is unchanged: verified, but its doc comment is detached (finding 3).
  • The context and helper are internal, with no public API change: verified (built API surface unchanged for Core and the themes).
  • Text skips mount measurement inside the context, and the measurement moved into an internal helper with the hook's behavior unchanged: verified (Text.tsx:280-282, useTruncation.ts:126).
  • The tooltip interest takes an optional measure callback and loads the Tooltip module after paint without waiting for truncation: verified (TruncationTooltip.tsx:81); this contradicts Text PR1 (finding 1).
  • Table FR2 gains one sentence: verified (Table.spec.md:221).
  • Red-first tests fail on main: verified for the Table test; the Text test imports the new context, so it was run on this head only.
  • Text, Heading, Table, Link and Lab LineClamp suites pass, and tsc and ESLint are clean: verified.
  • Tooltip code still loads after first paint, deduped page-wide: verified (Table.test.tsx:1455).
  • Keyboard focus is unchanged: verified (a default cell's text holds no focusable element).
  • Public text carries no internal context: verified.

Files:

  • .changeset/table-cell-measure-on-interest.md: finding 4
  • docs/specs/components/Table/Table.spec.md: clear (owner-approved at this head)
  • packages/core/src/Table/BaseTable.tsx: clear
  • packages/core/src/Table/Table.test.tsx: clear
  • packages/core/src/Text/Text.test.tsx: clear
  • packages/core/src/Text/Text.tsx: finding 2; non-blocking re-render and comment suggestions
  • packages/core/src/Text/TruncationTooltip.tsx: finding 1
  • packages/core/src/Text/textClampContext.ts: non-blocking comment suggestion
  • packages/core/src/Text/useTruncation.ts: finding 3

Automated review (maintainer link)

Comment thread packages/core/src/Text/Text.tsx Resolved
Comment thread packages/core/src/Text/useTruncation.ts Resolved
Comment thread packages/core/src/Text/Text.tsx Resolved
Comment thread packages/core/src/Text/Text.tsx Resolved
… next paint

Its preload ran in the passive effect, which a browser can flush before
the first frame presents, so the Tooltip chunk was requested just before
first paint. It now waits a frame and then a task, so the page paints
first, as tooltip code does elsewhere.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 2854851

@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. Measuring a default cell's truncation on interaction works, and with no interaction the Tooltip now loads after first paint, but five findings stand: three conflicts with current records, one lost doc comment and the release-note category.

  • TruncationTooltip.tsx:101-105 still loads the Tooltip module after first paint when no cell is truncated (the test at Table.test.tsx:1455 loads it once for a table whose cells fit, where main loads it zero times), which contradicts component:Text PR1 ("the Tooltip module loads only when the text is truncated"): amend PR1 for text that measures on interest, or keep the load tied to truncated text.
  • An open tooltip on a default cell keeps the old text when the cell's text changes, because the answer in Text.tsx:289-303 updates only at the next hover, tap or focus, which contradicts component:Text FR4 ("Truncation re-measures when the content changes without a resize"): measure again on a content change once the tooltip is wanted, or amend FR4 and PR1 for this mode.
  • A mouse that reaches a cut-off cell before the frame-and-task wait ends makes TruncationTooltip.tsx:99-100 load the Tooltip at once, before the page paints, which contradicts architecture:component-import-boundaries DEC-4 ("No input starts the load sooner or hurries it"): choose the branch by measure rather than isEnabled so this text always waits, and add the early-hover test that INV2's verification row asks for.
  • measureTruncation sits between useTruncation's JSDoc and the hook (useTruncation.ts:75-101), so the published useTruncation declaration has no doc comment: move the helper above the hook's JSDoc.
  • The changeset is tagged [fix], but nothing was broken on main and this is a performance change, so the release note should use [perf], as the repository's changeset guidance says.

An amended Text record needs an engineering owner's approval at the new head. The inline comments already on these lines still apply, including the non-blocking test and comment-style suggestions.

Claims and files checked

Review mode: same-head; reason: none

  • changed rules (0): none

Claims:

  • The changeset files the change as a fix: false (nothing was broken on main; it is a performance change).
  • A default truncating cell checks for truncation at its first hover, tap or focus instead of at mount: verified (Table.test.tsx:1423; Text.test.tsx:533).
  • A wide windowed table scrolls with less work: verified as mechanism (no mount read, observer or second render per cell); its timing is reported only together with three other pull requests.
  • Before this change each default cell measured and observed at mount and rendered again when the measurement landed: verified in the base useTruncation.
  • A cut-off cell shows its full text on the first hover, a fitting cell shows none, and later interactions measure again: verified (Text.test.tsx:548, :578, :596).
  • The DOM, custom renderCell content, Text outside default cells and useTruncation's return are unchanged: verified, but useTruncation's doc comment is detached.
  • The context and the helper are internal, with no public API change: verified (built API surface unchanged for Core and the themes).
  • Text skips mount measurement inside the context and the measurement moved into an internal helper: verified (Text.tsx:280-282, useTruncation.ts:126).
  • The tooltip interest takes an optional measure callback and, with it, loads the Tooltip after paint without waiting for a measured truncation: verified (TruncationTooltip.tsx:83, :101-105); this contradicts the Text record's load-only-when-truncated rule.
  • The Table record gains one sentence: verified (Table.spec.md:221).
  • The red-first tests fail on main: verified for the Table mount test; the Text test imports the new context, so it runs on this head only.
  • The Text, Heading, Table, Link and Lab LineClamp suites pass and tsc and ESLint are clean: verified.
  • Tooltip code still loads after first paint: verified with no interaction; false for a hover in the first frame on cut-off text, which loads it at once.
  • Keyboard focus is unchanged: verified (a default cell's text holds no focusable element).
  • Public text carries no internal context: verified.

Files:

  • .changeset/table-cell-measure-on-interest.md: [fix] category finding
  • docs/specs/components/Table/Table.spec.md: clear (owner-approved at this head)
  • packages/core/src/Table/BaseTable.tsx: clear
  • packages/core/src/Table/Table.test.tsx: non-blocking test suggestion
  • packages/core/src/Text/Text.test.tsx: clear
  • packages/core/src/Text/Text.tsx: stale tooltip finding; non-blocking re-render and comment suggestions
  • packages/core/src/Text/TruncationTooltip.tsx: load-when-fitting and early-hover findings; non-blocking comment suggestion
  • packages/core/src/Text/textClampContext.ts: non-blocking comment suggestion
  • packages/core/src/Text/useTruncation.ts: detached doc comment finding

Automated review (maintainer link)

Comment thread packages/core/src/Table/Table.test.tsx Resolved
…ip preload

Each such text scheduled its own frame and task for the preload, so a
table scheduled one pair per visible cell. They now share one per page:
the first text schedules it and the others join its promise.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec e3f44ab

@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. Measuring a default cell's truncation on interaction works, and the cells share one after-paint Tooltip preload, but seven findings stand: three conflicts with current records, a failing test, a kept load failure, a lost doc comment and the release-note category.

  • An open tooltip on a default cell keeps the old text when the cell's text changes, because the answer in Text.tsx:289-303 updates only at the next hover, tap or focus, which contradicts component:Text FR4 ("Truncation re-measures when the content changes without a resize"): measure again on a content change once the tooltip is wanted, or amend FR4 and PR1 for this mode.
  • TruncationTooltip.tsx:96 and :105 still load the Tooltip module after first paint when no cell is truncated, which contradicts component:Text PR1 ("the Tooltip module loads only when the text is truncated"): amend PR1 for text that measures on interest, citing the import-boundaries after-paint decision, or keep the load tied to truncated text.
  • The new test "loads the Tooltip module after a table of default cells paints, with no interaction" (Table.test.tsx:1455) fails when Table.test.tsx runs as a file (1 of 160), because the preload started by the preceding truncating-table test outlives its unmount and loads the mocked Tooltip first, so the hoisted counter never runs again after vi.resetModules(): register the counting mock with vi.doMock after vi.resetModules() in this test.
  • A hover that reaches a cut-off cell before the after-paint wait ends still makes TruncationTooltip.tsx:105 call tooltipModule.load() at once, which contradicts architecture:component-import-boundaries DEC-4 ("No input starts the load sooner or hurries it"): choose the branch by measure so a re-run joins the pending preload, and add the held-frame early-hover test that INV2's verification row asks for.
  • The module-level preload in TruncationTooltip.tsx:48-56 caches the Tooltip load beside the shared createModuleLoader, which drops a failed load, and keeps a rejected promise, so after one failed fetch the page never preloads again and the next hover on a cut-off cell waits for the code: let the shared loader own the after-paint wait, or reset preload when its load fails.
  • measureTruncation sits between useTruncation's JSDoc and the hook (useTruncation.ts:50-101), so the published useTruncation declaration has no doc comment: move the helper above the hook's JSDoc.
  • The changeset is tagged [fix], but nothing was broken on main and this is a performance change, so the release note should use [perf], as the repository's changeset guidance says.

An amended Text record needs an engineering owner's approval at the new head. The inline comments on this revision carry the details, including the non-blocking test and comment-style suggestions.

Claims and files checked

Review mode: same-head; reason: none

  • changed rules (0): none

Claims:

  • The changeset files the change as a fix: false (nothing was broken on main; it is a performance change).
  • A default truncating cell checks for cut-off text on its first hover, tap or focus instead of at mount: verified (Table.test.tsx:1423; Text.test.tsx:533).
  • A wide windowed table scrolls with less work: verified as mechanism (no mount read, observer or second render per cell); its timing is reported only together with three other pull requests.
  • A cut-off cell shows its full text on the first hover, a fitting cell shows none, and later interactions measure again: verified (Text.test.tsx:548, :578, :596).
  • The change reaches tables with truncation, the default with windowing: verified (BaseTable.tsx:842-844).
  • Before, each default cell measured and observed at mount and rendered again when the measurement landed: verified in the base truncation hook.
  • The DOM, custom renderCell content, Text outside default cells and useTruncation's return are unchanged: verified, but useTruncation's doc comment is detached.
  • The new context is internal and not exported from the package: verified.
  • Text skips mount measurement inside the context and measures when the tooltip interest asks: verified (Text.tsx:280-282, :312-315).
  • With a measure callback, the tooltip interest loads the Tooltip after the next paint without waiting for a measured truncation: verified with no interaction; false for an early hover on cut-off text, which loads it at once (TruncationTooltip.tsx:105).
  • The measurement moved into an internal helper and the hook's behavior and return are unchanged: verified (useTruncation.ts:82-99, :126).
  • Default string cells in truncate mode render inside the context: verified (BaseTable.tsx:271-285).
  • The Table record gains one sentence: verified, owner-approved at this head.
  • The Table mount test reads widths on main and none here: verified (9 reads on the base with the head's test, 0 here).
  • The Text mount test covers 20 texts: verified; it imports the new context, so it runs on this head only.
  • The Text, Heading, Table, Link and Lab LineClamp suites pass: false (Table.test.tsx fails one of 160 tests when run as a file; the other suites pass).
  • TypeScript and ESLint are clean: verified.
  • The combined real-Chrome timing with three other pull requests, including the release check's runner: not reproduced here (reported measurements).
  • Cells share one page-wide preload after the next paint, so the first hover finds the module ready: verified with no interaction; false for an early hover, and a failed preload is never retried.
  • A 40-row table asks for no more frames than a 3-row one: verified (Table.test.tsx:1474 passes).
  • The after-paint load test counts the module's import with a fresh module registry: false (it fails after an earlier truncating table in the same file).
  • Only the measurement moves to the first interaction: verified.
  • Keyboard focus is unchanged: verified (a default cell's text holds no focusable element).
  • No public API change: verified (built API surface unchanged for Core and the themes).
  • The record sentence states behavior in the present tense with no narration: verified.
  • Public text contains no internal context: verified.

Files:

  • .changeset/table-cell-measure-on-interest.md: [fix] category finding
  • docs/specs/components/Table/Table.spec.md: clear (owner-approved at this head)
  • packages/core/src/Table/BaseTable.tsx: clear
  • packages/core/src/Table/Table.test.tsx: failing after-paint test; non-blocking held-frame suggestion
  • packages/core/src/Text/Text.test.tsx: clear
  • packages/core/src/Text/Text.tsx: stale tooltip finding; non-blocking re-render and comment suggestions
  • packages/core/src/Text/TruncationTooltip.tsx: fitting-table load, early-hover and kept-failure findings; non-blocking comment suggestions
  • packages/core/src/Text/textClampContext.ts: non-blocking comment suggestion
  • packages/core/src/Text/useTruncation.ts: detached doc comment finding

Automated review (maintainer link)

Comment thread packages/core/src/Table/Table.test.tsx Resolved
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 4bb2c12

@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. CI's run on this head found no room under the CI ceiling and was cancelled before any build or test job ran, so re-run all jobs (or push later) to get a result. The measure-on-interest change is in order: both record edits carry an engineering owner's approval for this head, the public API is unchanged, and the Text and Table suites, the Core typecheck and a lint of the changed files pass on this head.

Optional:

  • The two after-paint load tests in Table.test.tsx (lines 1530 and 1569) keep waitFor's 1-second default; {timeout: 3000}, as the Text suite uses, keeps a slow shard from failing them.
  • The comment at TruncationTooltip.tsx:344-345, the Tooltip JSDoc at lines 304-305 and the TableHeaderCell record's PR1 could say the module loads "after the first paint".
Claims and files checked

Review mode: same-head; reason: none

  • Claim: before, each default cell measured and observed its text at mount, and that measurement rendered it again. Verified from the base hook, which observes at mount and sets the full text on the first measurement; the per-step profile figure is the author's measurement, not checked.
  • Claim: a default cell measures on its first hover, tap or focus; a cut-off cell shows its tooltip on that hover, a fitting cell shows none, and each later interaction measures again. Verified: Table.test.tsx:1482 reads scrollWidth 9 times on the base and 0 here; Text.test.tsx:548, :578, :724.
  • Claim: the DOM, custom renderCell content, Text outside default cells and useTruncation's public return are unchanged. Verified: the attribute check in Table.test.tsx:1482, BaseTable.tsx:301-315, useTruncation.ts:99-104, and the API surface comparison finds no changed row.
  • Claim: the new context is internal and not exported. Verified: Text/index.ts:60-65 exports only useTruncation and its two types.
  • Claim: the internal hook form measures and observes nothing at mount, measures when measure() runs, and follows content changes from the first measurement on. Verified: useTruncation.ts:209-211, :248-258; Text.test.tsx:533, :596.
  • Claim: Text turns the mode on inside the context, calls the truncation hook once and holds no measurement of its own. Verified: Text.tsx:270-281.
  • Claim: the tooltip interest takes an optional measure, calls it at the interaction, and with it starts the Tooltip load after the next paint without waiting for a measured truncation. Verified: TruncationTooltip.tsx:96-117, :126-135; Table.test.tsx:1514.
  • Claim: Table's default string cells in truncate mode render their Text inside the context. Verified: BaseTable.tsx:309-315.
  • Claim: the Table record gains one sentence and the Text record's PR1 loading clause defers to the after-paint decision. Verified in the diff; both are approved by an engineering owner for this head.
  • Claim: the two red-first tests fail on main and pass here. Verified: Table.test.tsx:1482, :1514 and :1538 fail on the base and pass here; the Text test imports the new context, so it runs only here, where it passes.
  • Claim: an open tooltip follows its text, and a cell cut off again by a resize, or changed to fit and then cut off, answers its next hover. Verified: Text.test.tsx:596, :630, :678 pass; the reset reads the rendered answer (TruncationTooltip.tsx:130-133).
  • Claim: no hover hurries the Tooltip load, and a failed preload lets the next text try again. Verified: Table.test.tsx:1538 fails on the base and passes here; the shared loader drops a failed load (utils/moduleLoader.ts:16-44).
  • Claim: first-load growth is docs +298, form +218, menu +302 and table +253 B gzip, and the table page, the one that renders the component without the feature, stays within 307 B. Partly verified: the figures were measured at an earlier commit; at this head the same script gives docs +293, form +218, menu +293 and table +232 B, each at or below the reported figure, and the table page passes.
  • Claim: the Text, Heading, Table, Link and Lab LineClamp suites pass, and typecheck and lint are clean. Verified: 799 tests in 22 files pass at this head, and the Core typecheck and lint of the changed files pass here; CI's own run at this head was refused for capacity before its build and test jobs.
  • Claim: the combined real-Chrome scroll timing with three companion pull requests meets the column-windowing timing targets. Not checked: the author's measurement of a combined build; no gate of this pull request alone depends on it.
  • Claim: Tooltip code still loads after first paint from one page-wide preload, whatever the number of cells. Verified: Table.test.tsx:1514, :1583.
  • Claim: keyboard focus on a default cell is unchanged. Verified: a default cell's text holds no focusable element (BaseTable.tsx:309-315).
  • Claim: preflight passes its build, typecheck, lint, knowledge and changeset steps; one interface test failed once on a heavily loaded machine. Partly verified: the typecheck, lint and interface tests pass here; the separate machine's runs were not checked; the failing test's waitFor keeps the 1-second default (see Optional).
  • Claim: the overlapping pull requests change when truncation state updates and server rendering of Text. Verified from their titles.
  • Changeset: a performance entry for Table's truncating default cells, with the cut-off cell's tooltip kept. Verified against the tests above.
  • Claim: the writing rubric finds nothing to report in the two record edits. Verified: both state behaviour in the present tense.
  • Claim: no public API change, and public text contains no internal context. Verified.
  • File .changeset/table-cell-measure-on-interest.md: clear.
  • File docs/specs/components/Table/Table.spec.md: clear (owner-approved for this head).
  • File docs/specs/components/Text/Text.spec.md: clear (owner-approved for this head).
  • File packages/core/src/Table/BaseTable.tsx: clear.
  • File packages/core/src/Table/Table.test.tsx: optional timeout note at lines 1530 and 1569.
  • File packages/core/src/Text/Text.test.tsx: clear.
  • File packages/core/src/Text/Text.tsx: clear.
  • File packages/core/src/Text/TruncationTooltip.tsx: clear; optional comment notes.
  • File packages/core/src/Text/textClampContext.ts: clear.
  • File packages/core/src/Text/useTruncation.ts: clear.

Automated review (maintainer link)

@cixzhang cixzhang added ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) lane:0 Astryx fix-loop lane 0 owns this labels Nov 21, 2026
@cixzhang
cixzhang marked this pull request as ready for review November 21, 2026 08:44
@cixzhang
cixzhang marked this pull request as draft November 21, 2026 10:19
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 1bced95

@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. CI has not run on this head yet: the pull request is a draft, so mark it ready for review to start CI. This head only merges main, which changes none of this pull request's files. The measure-on-interest change is in order: both record edits carry an engineering owner's approval for this head, the public API is unchanged, and the Text and Table suites, the Core typecheck and a lint of the changed files pass on this patch.

Optional:

  • The two after-paint load tests in Table.test.tsx (lines 1530 and 1569) keep waitFor's 1-second default; {timeout: 3000}, as the Text suite uses, keeps a slow shard from failing them.
  • The comment at TruncationTooltip.tsx:344-345, the Tooltip JSDoc at lines 304-305 and the TableHeaderCell record's PR1 could say the module loads "after the first paint".
Claims and files checked

Review mode: carry-forward; reason: none

  • Claim: before, each default cell measured and observed its text at mount, and that measurement rendered it again. Verified from the base hook, which observes at mount and sets the full text on the first measurement; the per-step profile figure is the author's measurement, not checked.
  • Claim: a default cell measures on its first hover, tap or focus; a cut-off cell shows its tooltip on that hover, a fitting cell shows none, and each later interaction measures again. Verified: Table.test.tsx:1482 reads scrollWidth 9 times on the base and 0 here; Text.test.tsx:548, :578, :724.
  • Claim: the DOM, custom renderCell content, Text outside default cells and useTruncation's public return are unchanged. Verified: the attribute check in Table.test.tsx:1482, BaseTable.tsx:301-315, useTruncation.ts:99-104, and the API surface comparison finds no changed row.
  • Claim: the new context is internal and not exported. Verified: Text/index.ts:60-65 exports only useTruncation and its two types.
  • Claim: the internal hook form measures and observes nothing at mount, measures when measure() runs, and follows content changes from the first measurement on. Verified: useTruncation.ts:209-211, :248-258; Text.test.tsx:533, :596.
  • Claim: Text turns the mode on inside the context, calls the truncation hook once and holds no measurement of its own. Verified: Text.tsx:270-281.
  • Claim: the tooltip interest takes an optional measure, calls it at the interaction, and with it starts the Tooltip load after the next paint without waiting for a measured truncation. Verified: TruncationTooltip.tsx:96-117, :126-135; Table.test.tsx:1514.
  • Claim: Table's default string cells in truncate mode render their Text inside the context. Verified: BaseTable.tsx:309-315.
  • Claim: the Table record gains one sentence and the Text record's PR1 loading clause defers to the after-paint decision. Verified in the diff; both are approved by an engineering owner for this head.
  • Claim: the two red-first tests fail on main and pass here. Verified: Table.test.tsx:1482, :1514 and :1538 fail on the base and pass with this patch; the Text test imports the new context, so it runs only here, where it passes.
  • Claim: an open tooltip follows its text, and a cell cut off again by a resize, or changed to fit and then cut off, answers its next hover. Verified: Text.test.tsx:596, :630, :678 pass; the reset reads the rendered answer (TruncationTooltip.tsx:130-133).
  • Claim: no hover hurries the Tooltip load, and a failed preload lets the next text try again. Verified: Table.test.tsx:1538 fails on the base and passes here; the shared loader drops a failed load (utils/moduleLoader.ts:16-44).
  • Claim: first-load growth is docs +298, form +218, menu +302 and table +253 B gzip, and the table page, the one that renders the component without the feature, stays within 307 B. Partly verified: the figures were measured at an earlier commit; on this patch the same script gives docs +293, form +218, menu +293 and table +232 B, each at or below the reported figure, and the table page passes.
  • Claim: the Text, Heading, Table, Link and Lab LineClamp suites pass, and typecheck and lint are clean. Verified on this patch: 799 tests in 22 files pass, and the Core typecheck and lint of the changed files pass; CI has not run on this head because it is a draft.
  • Claim: the combined real-Chrome scroll timing with three companion pull requests meets the column-windowing timing targets. Not checked: the author's measurement of a combined build; no gate of this pull request alone depends on it.
  • Claim: Tooltip code still loads after first paint from one page-wide preload, whatever the number of cells. Verified: Table.test.tsx:1514, :1583.
  • Claim: keyboard focus on a default cell is unchanged. Verified: a default cell's text holds no focusable element (BaseTable.tsx:309-315).
  • Claim: preflight passes its build, typecheck, lint, knowledge and changeset steps; one interface test failed once on a heavily loaded machine. Partly verified: the typecheck, lint and interface tests pass on this patch; the separate machine's runs were not checked; the failing test's waitFor keeps the 1-second default (see Optional).
  • Claim: the overlapping pull requests change when truncation state updates and server rendering of Text. Verified from their titles.
  • Changeset: a performance entry for Table's truncating default cells, with the cut-off cell's tooltip kept. Verified against the tests above.
  • Claim: the writing rubric finds nothing to report in the two record edits. Verified: both state behaviour in the present tense.
  • Claim: no public API change, and public text contains no internal context. Verified.
  • File .changeset/table-cell-measure-on-interest.md: clear.
  • File docs/specs/components/Table/Table.spec.md: clear (owner-approved for this head).
  • File docs/specs/components/Text/Text.spec.md: clear (owner-approved for this head).
  • File packages/core/src/Table/BaseTable.tsx: clear.
  • File packages/core/src/Table/Table.test.tsx: optional timeout note at lines 1530 and 1569.
  • File packages/core/src/Text/Text.test.tsx: clear.
  • File packages/core/src/Text/Text.tsx: clear.
  • File packages/core/src/Text/TruncationTooltip.tsx: clear; optional comment notes.
  • File packages/core/src/Text/textClampContext.ts: clear.
  • File packages/core/src/Text/useTruncation.ts: clear.

Automated review (maintainer link)

TruncationTooltip.tsx: main (#12443) moved useCutTextOnKeyboardFocus and its
measurement helpers into Text/cutTextOnKeyboardFocus.tsx and cutText.tsx,
which already load after the first paint. This branch's after-paint change
to that hook is superseded there, so the merge keeps main's removal; the
branch's after-paint preload for text that measures on interest stays.
…-text module

After main's #12443, a truncating header cell's keyboard cut-text loads its
own module (cutText.tsx), which imports Tooltip too, from an effect. The two
tests that count the cells' Tooltip load now stub that hook, so they keep
counting only the cells' after-paint load; the header path keeps its own
tests.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 21, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec ba80944

@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. The measure-on-interest change itself is in order: both record edits carry an engineering owner's approval for this head, the public API is unchanged, and the Table, Text, Heading, Link and Button suites, the Core typecheck and a lint of the changed files pass at this head. One thing blocks approval:

  • Regression: the description's first-load size bullet still gives an earlier commit's figures (docs +298, form +218, menu +302, table +253 B gzip), while at this head the four reference pages grow docs +291, form +236, menu +289 and table +230 B, so replace them with this head's measurements.

CI has not run on this head yet because the pull request is a draft.

Optional:

  • The two after-paint waitFor calls in Table.test.tsx (lines 1543 and 1582) keep the 1-second default; {timeout: 3000}, as the Text suite uses, keeps a slow shard from failing them.
Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: before, each default cell measured and observed its text at mount, and the result rendered it again. Verified from the base hook, which observes at mount and sets state on the first measurement; the per-step profile figure is the author's measurement, not checked.
  • Claim: a default cell measures on its first hover, tap or focus; a cut-off cell then shows its tooltip, a fitting cell shows none, and each later interaction measures again. Verified: Table.test.tsx:1495 (no reads at mount), Text.test.tsx:548, :578, :724; in Chromium the hover frames match the base.
  • Claim: the DOM, custom renderCell content, Text outside default cells and the public hook's return are unchanged. Verified: the attribute check in Table.test.tsx:1495, BaseTable.tsx:300-318, useTruncation.ts:99-104; the API surface comparison lists no row.
  • Claim: the new context is internal and not exported. Verified: Text/index.ts:60-65 exports only useTruncation and its types.
  • Claim: the internal hook form measures and observes nothing at mount, measures when measure() runs, and follows content changes from the first measurement on. Verified: useTruncation.ts:207-211, :248-258; Text.test.tsx:533, :596.
  • Claim: Text turns the mode on inside the context and calls the truncation hook once. Verified: Text.tsx:270-281.
  • Claim: the tooltip interest takes an optional measure, calls it at the interaction, and with it starts the Tooltip load after the next paint. Verified: TruncationTooltip.tsx:96-113, :122-143; Table.test.tsx:1527.
  • Claim: Table's default string cells in truncate mode render their Text inside the context. Verified: BaseTable.tsx:307-315.
  • Claim: the Table record gains one sentence and the Text record's PR1 defers loading to the after-paint decision. Verified in the diff; both are approved by an engineering owner for this head.
  • Claim: the mount-read tests fail on main and pass here. Verified: on the issued base with this head's Table.test.tsx, the mount-read test fails (9 reads), as do the after-paint load test and the held-frame hover test; all pass here. The Text test imports the new context, so it runs only here, where it passes.
  • Claim: an open tooltip follows its text, and a cell cut off again by a resize, or changed to fit and then cut off, answers its next hover. Verified: Text.test.tsx:596, :630, :678 pass.
  • Claim: no hover hurries the Tooltip load, and a failed preload lets the next text try again. Verified: Table.test.tsx:1551 passes; the shared loader drops a failed load (utils/moduleLoader.ts).
  • Claim: first-load growth is docs +298, form +218, menu +302 and table +253 B gzip, and the table page stays within the 0.3 KB bound. False for this head: docs +291, form +236, menu +289 and table +230 B; the table page passes (see the finding above).
  • Claim: the Text, Heading, Table, Link and LineClamp suites pass, and typecheck and lint are clean. Verified at this head: 1,281 tests in 60 files (Table, Text, Heading, Link, Button), the Core typecheck and a lint of the changed files pass.
  • Claim: the combined real-Chrome scroll timing with three companion pull requests meets the column-windowing targets. Not checked: the author's measurement of a combined build.
  • Claim: Tooltip code still loads after first paint from one page-wide preload, whatever the number of cells. Verified: Table.test.tsx:1527, :1596.
  • Claim: keyboard focus on a default cell is unchanged. Verified: the cell's text holds no focusable element (BaseTable.tsx:307-315).
  • Claim: preflight passes at an earlier commit, with one interface test failing once under heavy load. Not checked at this head; this head's local runs of those tests pass.
  • Claim: the overlapping pull requests change when truncation state updates and server rendering of Text. Not rechecked: unchanged since the last review.
  • Claim: the writing rubric finds nothing to report in the two record edits. Verified: both state behaviour in the present tense.
  • Claim: no public API change, and public text holds no internal context. Verified.
  • Changeset: a performance entry for Table's truncating default cells that keeps the cut-off cell's tooltip. Verified against the tests above.
  • New test commit: the two Tooltip-load tests stub the header's cut-text hook so they count only the cells' load. Verified: without the stub both fail at this head ("expected 1 to be +0").
  • File .changeset/table-cell-measure-on-interest.md: clear.
  • File docs/specs/components/Table/Table.spec.md: clear (owner-approved for this head).
  • File docs/specs/components/Text/Text.spec.md: clear (owner-approved for this head).
  • File packages/core/src/Table/BaseTable.tsx: clear.
  • File packages/core/src/Table/Table.test.tsx: optional timeout note at lines 1543 and 1582.
  • File packages/core/src/Text/Text.test.tsx: clear.
  • File packages/core/src/Text/Text.tsx: clear.
  • File packages/core/src/Text/TruncationTooltip.tsx: clear; the merge leaves main's cut-text code out of this file.
  • File packages/core/src/Text/textClampContext.ts: clear.
  • File packages/core/src/Text/useTruncation.ts: clear.

Automated review (maintainer link)

…ite's do

A loaded shard can take more than the 1 s default before the after-paint
Tooltip load lands.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 2588089

@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. Table's truncating default cells now measure on the first hover, tap or focus, with the same tooltip result; both record edits carry an engineering owner's approval for this head, the public API is unchanged, and the description's first-load figures match this patch. CI passes on this head.

Claims and files checked

Review mode: same-head; reason: none

  • changed rules (0): none
  • Claim: before, each default cell measured and observed its text at mount, and the result rendered it a second time. Verified from the base hook, which observes at mount and sets state when the measurement lands; the per-step profile figure is the author's measurement, not checked.
  • Claim: a default cell measures on its first hover, tap or focus; a cut-off cell then shows its full text in a tooltip, a fitting cell shows none, and each later interaction measures again. Verified: Table.test.tsx:1495, Text.test.tsx:548, :578, :724.
  • Claim: the DOM, custom renderCell content, Text outside default cells and the public hook's return are unchanged. Verified: the attribute check in Table.test.tsx:1495, BaseTable.tsx:301-318, useTruncation.ts:99-104; the built API surface comparison lists no row.
  • Claim: the new context is internal and not exported from the package. Verified: textClampContext.ts:27-31; Text/index.ts:61-66 re-exports only useTruncation and its types.
  • Claim: the internal hook form measures and observes nothing at mount, measures when measure() runs, follows content changes from the first measurement on, and the public hook keeps its signature and return. Verified: useTruncation.ts:99-104, :207-211, :248-258; Text.test.tsx:533, :596.
  • Claim: Text turns the mode on inside the context, calls the truncation hook once and holds no measurement of its own. Verified: Text.tsx:270-295.
  • Claim: the tooltip interest takes an optional measure, calls it at the interaction, and with it starts the Tooltip load after the next paint without waiting for a measured truncation. Verified: TruncationTooltip.tsx:81-113, :122-143; Table.test.tsx:1527.
  • Claim: Table's default string cells in truncate mode render their Text inside the context. Verified: BaseTable.tsx:307-315.
  • Claim: the Table record gains one sentence and the Text record's PR1 defers loading to the after-paint decision and names text that measures on interest. Verified in the diff; both are approved by an engineering owner for this head.
  • Claim: a performance changeset. Verified: the entry is tagged [perf] and describes only Table's truncating default cells.
  • Claim: the mount-read tests fail on main and pass here. Verified for the Table test: on the base with this head's Table.test.tsx it fails (9 width reads); the Text test imports the new context, so it runs only here, where it passes.
  • Claim: the first hover measures and opens the tooltip of truncated text, fitting text mounts none, and a later hover measures again. Verified: Text.test.tsx:548, :578, :724 pass.
  • Claim: an open tooltip follows its text, and a cell cut off again by a resize, or changed to fit and then cut off, answers its next hover. Verified: Text.test.tsx:596, :630, :678 pass; the statements that they failed on an earlier commit were not rechecked.
  • Claim: no hover hurries the Tooltip load, and a failed preload lets the next text try again. Verified: Table.test.tsx:1554 passes here and fails on the base (an early load); the shared module loader drops a failed load (utils/moduleLoader.ts:33-44).
  • Claim: first-load growth is docs +291, form +236, menu +289 and table +230 B gzip, later commits change tests only, and the table page passes the 0.3 KB bound. Verified: measured at this head, docs +291, form +236, menu +288, table +230 B, table within the bound; the source is unchanged since the measured commit.
  • Claim: the Text, Heading, Table, Link and LineClamp suites pass, and typecheck and lint are clean. Verified at this head: the Table, Text, Heading, Link and Button suites (1,281 tests), Lab's LineClamp (46 tests), the Core typecheck and ESLint on the changed files pass; CI's test, lint and build jobs also pass here.
  • Claim: the combined real-Chrome scroll timing with three companion pull requests meets the column-windowing targets. Not checked: the author's measurement of a combined build.
  • Claim: Tooltip code still loads after first paint from one page-wide preload, whatever the number of cells. Verified: Table.test.tsx:1527, :1602 pass.
  • Claim: keyboard focus on a default cell is unchanged. Verified: the cell renders only its string inside Text, with no focusable element (BaseTable.tsx:309-315).
  • Claim: preflight passed at an earlier commit on another machine, with one interface test failing once under heavy load. Not checked at that commit; this head's runs of those suites pass.
  • Claim: the overlapping pull requests change when truncation state updates and move Text toward server rendering. Verified from their titles.
  • Claim: the writing rubric finds nothing to report in the two record edits. Verified: both state behaviour in the present tense with no history, research or project status.
  • Claim: no public API change, and public text holds no internal context. Verified: the API comparison lists no row, and the title, body, branch, commits and patches hold no internal reference.
  • File .changeset/table-cell-measure-on-interest.md: clear.
  • File docs/specs/components/Table/Table.spec.md: clear (owner-approved for this head).
  • File docs/specs/components/Text/Text.spec.md: clear (owner-approved for this head).
  • File packages/core/src/Table/BaseTable.tsx: clear.
  • File packages/core/src/Table/Table.test.tsx: clear.
  • File packages/core/src/Text/Text.test.tsx: clear.
  • File packages/core/src/Text/Text.tsx: clear.
  • File packages/core/src/Text/TruncationTooltip.tsx: clear.
  • File packages/core/src/Text/textClampContext.ts: clear.
  • File packages/core/src/Text/useTruncation.ts: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 21, 2026 17:17
github-actions Bot added a commit that referenced this pull request Nov 21, 2026

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

Looks good. The table appearance is unchanged, the first hover still shows the full cut-off text, and widening then narrowing a column keeps later hover answers correct. Design approval based on the exact-revision Chromium comparison; the broader scrolling-speed claims were not independently validated.

@cixzhang
cixzhang merged commit 4c3bcab into main Nov 21, 2026
159 checks passed
@github-actions
github-actions Bot deleted the l0/table-cell-measure-on-interest branch November 22, 2026 06:04

This branch was successfully deployed

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

Labels

ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot. lane:0 Astryx fix-loop lane 0 owns this needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants