Skip to content

perf(core): a cut label's tooltip and its measurement load after the first paint - #12443

Merged
cixzhang merged 14 commits into
mainfrom
perf/cut-label-after-paint
Nov 21, 2026
Merged

cixzhang merged 14 commits into
mainfrom
perf/cut-label-after-paint

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Primary intent

Take the measurement that decides whether a Button's label is cut out of every page's first load. It now loads after the page's first paint, together with the cut-label tooltip, which already loaded after mount.

User impact

  • Everyone loading a page with a Button: less JavaScript before first paint. Measured with pnpm size:pages against main 484f7af (gzip), at head fbdc420:
Page Change
form (Button, IconButton, TextInput, CheckboxInput, Text, Heading, Card) −413 B
table (Table, Text, Button) −293 B
menu (DropdownMenu, ContextMenu, Button, Text) −246 B
a page with only a Button −378 B
docs (Text, Heading, Link, Card, Divider, List) +10 B (chunk naming; no Button)
  • Keyboard users: Tab onto a Button whose label is cut shows the full label in a tooltip that adds no description, as before. Escape closes it, a press closes it (also one made while the tooltip is still loading), and a caller's tooltip on a Button still wins. A cut sortable heading still shows when a caller's tooltip describes the header cell. A keyboard focus that arrives before the tooltip module has loaded shows it once it loads, if focus is still there.
  • Mouse and touch users: unchanged. A hover or a press shows nothing.

Change

  • New Text/cutText.tsx (the module that loads after first paint) holds the cut-text measurement (moved from TruncationTooltip.tsx), the caller-tooltip check (moved from Button.tsx, applied only when the hook's caller asks with yieldsToCallerTooltip, which Button sets), and re-exports UndescribedTooltip.
  • New Text/cutTextOnKeyboardFocus.tsx holds useCutTextOnKeyboardFocus, the first-load part:
    • It keeps only the focus handlers and loads cutText.tsx after the first paint.
    • Keyboard focus means :focus-visible and a keyboard reading from the shared interaction-modality reader, as before. (A Button page already loads that reader through useTooltip.) A text field a pointer focused still shows nothing.
    • It returns the tooltip element to render.
  • Button.tsx and TableHeaderCell.tsx render the tooltip the hook returns. TruncationTooltip.tsx loses the moved code, and Text and Heading are unchanged.
  • Tests:
    • New Button/__tests__/ButtonCutLabel.interaction.browser.spec.ts covers keyboard focus, Escape, hover, and a fitting label. Its load-window case holds the module's request so the focus truly lands while it loads.
    • New browser case: a press during the held load drops the held focus (fails at 1ef005a, passes now).
    • New unit cases: keyboard focus still shows after a press that left focus outside the Button, after a press on a header cell outside its sort control, and while a caller's tooltip describes the header cell (fails at 1ef005a).
  • Text record: names the hook's new files.
  • Record: Button's FR18 verification row and verified_by will name the new browser spec in a records-only follow-up; this PR leaves Button.spec.md as main has it, because another open change edits that file.
  • Changeset: [perf] patch.

Authority

  • architecture:component-import-boundaries DEC-4 and INV2: tooltip surfaces load after the page's first paint, and no input starts that load sooner.
  • Button FR18: behavior unchanged.
  • The Specification session's ruling for this item: the measurement loads with the tooltip after first paint, and Button keeps only a small focus handler.

Evidence

  • Real Chromium and Firefox (Playwright 1.61.1): the new spec passes 4/4 in each.
  • Unit tests for Button, Table, Text, Heading, Tooltip and ToggleButton pass 1726/1726 at fbdc420; check:component-import-boundaries holds. The two new press cases fail with the earlier press latch, and the existing suites, including the pointer-focused-field case, are unchanged.
  • tsc, eslint, check:knowledge, check:changesets, check:component-import-boundaries and check:use-client are clean.
  • Code-split bundle test: with splitting, esbuild marks each dynamic import as an entry point too, so the new import('./cutText') reordered the outputs and scripts/core-single-bundle.test.mjs began its startup walk at the search sheet's lazy chunk. The walk now starts at the app's own main.jsx output; the real startup chunks hold no bottom sheet. At head 9dc702f (main 9dacfbd merged) the test passes 3/3 (it failed 1/3 before the fix), and Button, Table and Text units pass 1504/1504.
  • The keyboard hook's hide is the open tooltip's onHide, so it is a stable callback: an open tooltip no longer re-runs its controlled-open Effect on each render.
  • What stays in the first load: with the cut-label hook stubbed out, a Button-only page is 708 B gzip smaller than main. At this head it is 378 B smaller, so the cut-label code that stays in the first load (the focus hook, its use of the shared modality reader, and the module loader) is about 330 B, down from about 708 B on main. This PR adds no first-load code; it removes it.

Overlap checked: #12371 (merged) also edited Button.spec.md; this PR no longer changes that file.

Writing rubric results

  • R1 narration: the record lines name files and tests in the present tense.
  • R2 research: none.
  • R3 evidence: none in the record beyond verified_by and verification rows.
  • R4 rejected alternatives: none.
  • R5 change references: none.
  • R6 open questions: none.
  • R7 project status: none.

Owner and land path

  • Owner: Astryx maintainers, fix-loop lane 1.
  • Land path: code review, CI, merge.

…first paint

A Button imported the truncation tooltip module for its cut-label tooltip,
which brought the cut-text measurement, the interaction-modality tracker and
Text's truncation interest code into every page's first load (about 0.7 KB
gzip). The measurement, the caller-tooltip check and the undescribed tooltip
now sit in one module, cutText.tsx, that loads after the page's first paint.
The first-load part, cutTextOnKeyboardFocus.tsx, keeps only the focus
handlers: keyboard focus (:focus-visible, with no press inside the anchor
since focus entered it) measures through the loaded module, and a focus that
arrives before it loads is measured when it loads, if focus is still there.

Button and TableHeaderCell render the tooltip the hook returns. A browser
spec covers keyboard focus, a focus before the module loads, Escape, hover
and a fitting label in Chromium and Firefox.
@vercel

vercel Bot commented Nov 17, 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 1:04pm UTC

Request Review

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

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

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

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 70a8df7

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 45ab9ca

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
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) — ✗ · ✓ · ✗
114 more components
Component Size LoC Visual · A11y · RTL
TableRow 7.2 kB (0) · 4.1 kB CSS (0) — ✗ · ✓ · ✗
TableCell 106.1 kB (−173 B) · 20.1 kB CSS (0) — ✗ · ✓ · ✓
TableHeaderCell 105.9 kB (−195 B) · 20.0 kB CSS (0) — ✗ · ✓ · ✓
Table 123.9 kB (−255 B) · 21.1 kB CSS (0) — ✗ · ✓ · —
Button · Storybook 67.1 kB (−413 B) · 11.1 kB CSS (0) 830 (−15) ✓ · ✓ · ✗
TableSelectionToolbar 77.6 kB (−413 B) · 14.5 kB CSS (0) — ✗ · ✓ · ✓
DropdownMenuSubMenu 80.3 kB (+19 B) · 11.0 kB CSS (0) — — · — · —
CommandPalette 82.6 kB (+5 B) · 13.5 kB CSS (0) — — · — · —
Field 61.0 kB (+5 B) · 7.6 kB CSS (0) — — · — · —
InputGroup 63.2 kB (+3 B) · 8.8 kB CSS (0) — — · — · —
RadioListItem 78.0 kB (+3 B) · 11.1 kB CSS (0) — — · — · —
TextArea 94.5 kB (+3 B) · 10.0 kB CSS (0) — — · — · —
lab/SelectableCardGroup 71.4 kB (+3 B) · 162 B CSS (0) — — · — · —
ListItem 81.1 kB (+1 B) · 12.5 kB CSS (0) — — · — · —
Switch 111.0 kB (+1 B) · 10.4 kB CSS (0) — — · — · —
CheckboxInput 71.0 kB (0) · 10.6 kB CSS (0) — — · — · —
CommandPaletteInput 34.0 kB (0) · 7.9 kB CSS (0) — — · — · —
Slider 116.2 kB (0) · 9.2 kB CSS (0) — — · — · —
lab/TabBarMoreList 104.1 kB (0) · 1.8 kB CSS (0) — — · — · —
CheckboxList 74.7 kB (−1 B) · 8.1 kB CSS (0) — — · — · —
Link 57.8 kB (−3 B) · 7.4 kB CSS (0) — — · — · —
RadioList 62.5 kB (−3 B) · 7.6 kB CSS (0) — — · — · —
CheckboxListItem 81.9 kB (−10 B) · 12.5 kB CSS (0) — — · — · —
charts/Chart 247.5 kB (−155 B) · 516 B CSS (0) — — · — · —
charts/ChartTooltip 223.9 kB (−190 B) · 451 B CSS (0) — — · — · —
DropdownMenu 113.0 kB (−193 B) · 19.8 kB CSS (0) — — · — · —
MoreMenu 113.3 kB (−195 B) · 19.8 kB CSS (0) — — · — · —
AppShell 100.6 kB (−205 B) · 14.9 kB CSS (0) — — · — · —
lab/MediaFullscreenButton 223.0 kB (−208 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaPlayButton 223.0 kB (−208 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaCaptionsButton 223.0 kB (−209 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaPlaybackRate 223.0 kB (−209 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaSeekButton 223.0 kB (−209 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaTime 223.0 kB (−209 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaTimeSlider 223.0 kB (−209 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaVolume 223.0 kB (−210 B) · 1.5 kB CSS (0) — — · — · —
lab/Schedule 117.4 kB (−214 B) · 3.9 kB CSS (0) — — · — · —
ContextMenu 104.8 kB (−215 B) · 19.6 kB CSS (0) — — · — · —
DateInput 207.8 kB (−236 B) · 18.9 kB CSS (0) — — · — · —
lab/AudioPlayer 233.1 kB (−241 B) · 1.8 kB CSS (0) — — · — · —
NumberInput 105.8 kB (−246 B) · 13.0 kB CSS (0) — — · — · —
lab/VideoPlayer 230.7 kB (−246 B) · 2.1 kB CSS (0) — — · — · —
richtext/RichTextEditorToolbar 314.8 kB (−255 B) · 454 B CSS (0) — — · — · —
DateTimeInput 231.7 kB (−261 B) · 20.6 kB CSS (0) — — · — · —
MultiSelector 108.7 kB (−267 B) · 18.9 kB CSS (0) — — · — · —
BreadcrumbItem 102.1 kB (−270 B) · 14.0 kB CSS (0) — — · — · —
Typeahead 94.5 kB (−272 B) · 14.4 kB CSS (0) — — · — · —
AlertDialog 132.8 kB (−277 B) · 16.2 kB CSS (0) — — · — · —
TopNavMegaMenu 81.4 kB (−280 B) · 13.0 kB CSS (0) — — · — · —
Selector 119.8 kB (−282 B) · 19.7 kB CSS (0) — — · — · —
SideNavHeading 87.7 kB (−286 B) · 12.5 kB CSS (0) — — · — · —
TextInput 100.9 kB (−287 B) · 12.8 kB CSS (0) — — · — · —
ComplexSelector 83.3 kB (−289 B) · 13.2 kB CSS (0) — — · — · —
TimeInput 179.9 kB (−296 B) · 17.8 kB CSS (0) — — · — · —
SideNavItem 82.0 kB (−300 B) · 12.3 kB CSS (0) — — · — · —
TabMenu 83.9 kB (−302 B) · 12.3 kB CSS (0) — — · — · —
DateRangeInput 105.8 kB (−304 B) · 14.2 kB CSS (0) — — · — · —
TopNavHeading 87.4 kB (−306 B) · 12.4 kB CSS (0) — — · — · —
TopNavMenu 86.8 kB (−310 B) · 12.4 kB CSS (0) — — · — · —
BaseTypeahead 83.6 kB (−312 B) · 12.1 kB CSS (0) — — · — · —
lab/DiffViewer 95.5 kB (−316 B) · 2.1 kB CSS (0) — — · — · —
Tokenizer 112.5 kB (−321 B) · 21.9 kB CSS (0) — — · — · —
ChatComposer 90.4 kB (−323 B) · 13.5 kB CSS (0) — — · — · —
ChatComposerTokenElement 87.5 kB (−331 B) · 12.5 kB CSS (0) — — · — · —
ChatLayout 90.8 kB (−331 B) · 11.7 kB CSS (0) — — · — · —
ChatComposerInput 87.5 kB (−332 B) · 12.5 kB CSS (0) — — · — · —
FileInput 77.0 kB (−337 B) · 12.8 kB CSS (0) — — · — · —
CodeBlock 83.3 kB (−339 B) · 12.9 kB CSS (0) — — · — · —
Markdown 208.1 kB (−341 B) · 23.4 kB CSS (0) — — · — · —
lab/DialogHeroHeader 91.8 kB (−343 B) · 372 B CSS (0) — — · — · —
PowerSearch 317.7 kB (−347 B) · 27.3 kB CSS (0) — — · — · —
lab/TransferListSelector 150.6 kB (−360 B) · 1.4 kB CSS (0) — — · — · —
ToggleButton 94.4 kB (−365 B) · 11.3 kB CSS (0) — — · — · —
lab/ChatEmojiPicker 127.3 kB (−368 B) · 773 B CSS (0) — — · — · —
lab/ChatReactionBar 128.5 kB (−368 B) · 1.1 kB CSS (0) — — · — · —
Pagination 152.8 kB (−376 B) · 20.0 kB CSS (0) — — · — · —
lab/ListInput 96.8 kB (−378 B) · 922 B CSS (0) — — · — · —
Carousel 77.3 kB (−379 B) · 12.1 kB CSS (0) — — · — · —
SideNav 123.6 kB (−379 B) · 12.5 kB CSS (0) — — · — · —
lab/TourStep 96.3 kB (−381 B) · 691 B CSS (0) — — · — · —
Popover 103.9 kB (−384 B) · 15.5 kB CSS (0) — — · — · —
Calendar 78.3 kB (−386 B) · 11.8 kB CSS (0) — — · — · —
Thumbnail 71.6 kB (−386 B) · 12.7 kB CSS (0) — — · — · —
ChatLayoutScrollButton 67.7 kB (−391 B) · 11.3 kB CSS (0) — — · — · —
lab/CommentThread 380.8 kB (−391 B) · 2.4 kB CSS (0) — — · — · —
SideNavCollapseButton 68.0 kB (−394 B) · 11.2 kB CSS (0) — — · — · —
richtext/RichTextView 287.1 kB (−396 B) · 2.4 kB CSS (0) — — · — · —
richtext/RichTextEditor 310.3 kB (−402 B) · 2.7 kB CSS (0) — — · — · —
DialogHeader 70.4 kB (−403 B) · 12.8 kB CSS (0) — — · — · —
DrawerHeader 70.6 kB (−405 B) · 14.3 kB CSS (0) — — · — · —
Stepper 68.9 kB (−406 B) · 11.3 kB CSS (0) — — · — · —
Toast 106.9 kB (−406 B) · 11.5 kB CSS (0) — — · — · —
ChatSendButton 67.6 kB (−408 B) · 11.1 kB CSS (0) — — · — · —
lab/EmojiPicker 120.5 kB (−410 B) · 751 B CSS (0) — — · — · —
ChatDictationButton 67.7 kB (−411 B) · 11.2 kB CSS (0) — — · — · —
IconButton 67.2 kB (−418 B) · 11.1 kB CSS (0) — — · — · —
MobileNavToggle 67.5 kB (−418 B) · 11.1 kB CSS (0) — — · — · —
lab/TransferList 138.7 kB (−418 B) · 1.2 kB CSS (0) — — · — · —
Banner 69.2 kB (−421 B) · 11.6 kB CSS (0) — — · — · —
Lightbox 150.7 kB (−426 B) · 12.3 kB CSS (0) — — · — · —
TopNav 80.5 kB (−453 B) · 12.1 kB CSS (0) — — · — · —
MobileNav 78.6 kB (−464 B) · 11.8 kB CSS (0) — — · — · —
lab/Comments 387.8 kB (−510 B) · 2.5 kB CSS (0) — — · — · —
lab/CommentComposer 185.3 kB (−1.2 kB) · 1.9 kB CSS (0) — — · — · —
Spinner 24.9 kB (−1.8 kB) · 6.6 kB CSS (0) — — · — · —
lab/LineClamp 13.8 kB (−1.8 kB) · 168 B CSS (0) — — · — · —
ChatToolCalls 32.7 kB (−1.9 kB) · 8.8 kB CSS (0) — — · — · —
Text · Storybook 11.4 kB (−1.9 kB) · 5.8 kB CSS (0) 935 (+63) ✓ · ✓ · —
ChatMessageList 28.3 kB (−1.9 kB) · 7.4 kB CSS (0) — — · — · —
NavHeadingMenuItem 16.8 kB (−1.9 kB) · 6.7 kB CSS (0) — — · — · —
Timer 13.8 kB (−1.9 kB) · 6.4 kB CSS (0) — — · — · —
Heading 12.1 kB (−1.9 kB) · 5.8 kB CSS (0) — — · — · —
Timestamp 27.7 kB (−3.6 kB) · 11.4 kB CSS (0) — — · — · —
charts/ChartLegend 41.8 kB (−7.5 kB) · 224 B 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 7 newest reports of other pull requests.

Package size: @astryxdesign/core 7.95 MB packed (+4.4 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

@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. Deferring the cut-text measurement works and keeps its first-load saving, but the new press latch breaks keyboard focus on cut labels and headings in one common case.

  • Keyboard focus no longer shows a cut Button label or a cut sortable heading after a press that left focus outside the control (a Button click in macOS Safari or Firefox, or, in any browser, a press on a header cell outside its sort control), because isPressedRef in Text/cutTextOnKeyboardFocus.tsx:146 stays set until focus enters and then leaves the anchor; gate onFocus on the shared modality reader again (useInteractionModalityTrackingFor(anchorRef, isEnabled) with readModality() !== 'keyboard') and add both cases as tests.
  • The hook now tracks pointer presses itself to tell keyboard focus from pointer focus, a concern that utils/interactionModality.ts owns (react-component-runtime INV16), and that tracker is still in a Button page's first load through useTooltip → useTouchTrigger, so the first fix resolves this too.
  • The changeset's "keyboard focus on a cut label still shows it in full" and the description's "keyboard users: unchanged" are false at this head, and the description's claim that the interaction-modality tracker "stays out of the first load" is false at any head, so drop that claim and keep the other two once the first fix lands.

With the shared reader restored, the reference pages keep their saving (form −396 B, Button only −361 B, table −262 B, menu −227 B gzip) and the existing truncation suites still pass. Three smaller follow-ups: Text's record still places useCutTextOnKeyboardFocus in Text/TruncationTooltip.tsx; the file headers in cutText.tsx and cutTextOnKeyboardFocus.exports.test.ts name the wrong files; and the browser spec's pending-load case never checks that the module is still loading when Tab is pressed.

Claims and files checked

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

Claims:

  • Changeset: the cut-label tooltip and its measurement load after first paint, not with the Button. Verified: the mount Effect in cutTextOnKeyboardFocus.tsx:87-109 loads cutText.tsx, and the import-boundaries check passes.
  • Changeset: pages that render a Button load about 0.2–0.4 KB less before first paint. Verified: a rebuild measures 226–404 B gzip less.
  • Changeset: keyboard focus on a cut label still shows it in full. False after a press that moved no focus (probe test; Chromium capture).
  • Changeset: a focus before the tooltip loads shows it once loaded. Verified by a unit probe, and the browser spec's second case passes in Chromium.
  • Changeset: table header cells load the same way. Verified: TableHeaderCell.tsx:173 and :227.
  • Description: per-page sizes (form −404 B, table −262 B, menu −223 B, Button only −371 B, docs +10 B). Verified; the rebuild gives menu −226 B and every other figure exactly.
  • Description: keyboard users unchanged, and Button FR18 behavior unchanged. False (finding 1).
  • Description: Escape closes the tooltip, and a caller's tooltip wins. Verified by spec case 1, cutText.tsx:108 and the caller-tooltip unit tests.
  • Description: hover and press show nothing. Verified by unit suites and spec case 3.
  • Description: cutText.tsx holds the measurement moved from TruncationTooltip.tsx, the caller-tooltip check moved from Button.tsx, and a re-export of UndescribedTooltip. Verified from the diff.
  • Description: the first-load hook keeps only the focus handlers and loads the module after first paint. Verified.
  • Description: keyboard focus means :focus-visible with no press since focus entered. False as stated: the latch also holds a press made before focus entered (:146, :127-134).
  • Description: this replaces the modality tracker, which stays out of the first load. False: utils/interactionModality.js stays in a Button page's first load through Layer/useTouchTrigger.ts:386.
  • Description: a pointer-focused text field still shows nothing. Verified by the TableHeaderCell pointer-field test.
  • Description: Button and TableHeaderCell render the returned tooltip, and Text and Heading are unchanged. Verified: Button.tsx:1215, TableHeaderCell.tsx:227, no Text or Heading source change.
  • Description: the new browser spec covers keyboard focus, focus before load, Escape, hover and a fitting label. Verified by reading; the pending case is weak (non-blocking).
  • Description: Button's FR18 verification row and verified_by name the new spec, and the changeset is a perf patch. Verified.
  • Description: tooltip surfaces load after first paint and no input starts the load sooner. Verified against the import-boundaries record.
  • Description: the new spec passes in Chromium and Firefox. Chromium verified, 3/3; Firefox not re-run.
  • Description: unit suites pass 1723/1723. Verified: 74 files, 1723 tests.
  • Description: tsc, eslint and the knowledge, changeset, import-boundaries and use-client checks are clean. Verified.
  • Description: with no cut-label feature the page would be 660 B smaller, and about 290 B remains. Not re-measured.
  • Description: an overlapping pull request edits only Button's FR17 line. Verified: its record hunk does not overlap these lines.

Files:

  • .changeset/button-cut-label-after-paint.md: finding 3.
  • docs/specs/components/Button/Button.spec.md: clear.
  • packages/core/src/Button/Button.tsx: clear.
  • packages/core/src/Button/__tests__/ButtonCutLabel.interaction.browser.spec.ts: non-blocking, the pending-load case.
  • packages/core/src/Table/TableHeaderCell.tsx: clear in itself; it inherits finding 1 through the hook.
  • packages/core/src/Text/TruncationTooltip.tsx: clear.
  • packages/core/src/Text/cutText.tsx: non-blocking, the file header.
  • packages/core/src/Text/cutTextOnKeyboardFocus.exports.test.ts: non-blocking, the file header.
  • packages/core/src/Text/cutTextOnKeyboardFocus.tsx: findings 1 and 2.

Automated review (maintainer link)

Comment thread packages/core/src/Text/cutText.tsx Resolved
The press latch kept a later keyboard focus from showing a cut label or
heading after a press that left focus outside the control (a Button click
in macOS Safari or Firefox, or a press on a header cell outside its sort
control). The hook reads the shared interaction-modality reader again, which
a Button page already loads through useTooltip, and the first-load saving
holds. Unit cases cover both presses; the browser spec holds the tooltip
module's request to prove a focus during the load shows once it loads.
Text's record names the hook's new files; two file headers are corrected.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 1ef005a

@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. Deferring the cut-text measurement works: pages with a Button load 228–396 B less gzip before first paint, keyboard focus on a cut Button label is unchanged, and the earlier press-latch finding is fixed. Three issues remain:

  • Miss: keyboard focus on a cut sortable heading now shows nothing when the header cell's aria-describedby names a caller's role="tooltip" element, because cutText.tsx:108 applies Button's caller-tooltip check to every anchor while TableHeaderCell's FR2 has no such exception, so keep the check Button-only (an option that Button sets) or get FR2 amended, and add a test.
  • Miss: the changeset and the description's primary intent say that the cut-label tooltip now loads after first paint instead of with the Button (or leaves every page's first load), but the base already loaded it through the module loader after mount, so reword them to say that the measurement now loads after first paint together with its tooltip.
  • Miss: a mouse press on a cut Button while its module is still loading no longer closes the tooltip, because onPointerDown at cutTextOnKeyboardFocus.tsx:145 clears the shown text but not the held focus in pendingRef, so clear pendingRef there too and add a test.

One smaller suggestion: rename pendingRef to heldFocusRef and drop the comment above it.

Claims and files checked

Review mode: same-head; reason: none

Claims:

  • Changeset: the measurement that decides whether a label is cut loads after first paint instead of with the Button. Verified: cutTextOnKeyboardFocus.tsx:30 and :85-107; a Button page's first load no longer holds it.
  • Changeset: the cut-label tooltip loads after first paint instead of with the Button. False: the base already loaded it after mount (Text/TruncationTooltip.tsx:45 and :306-325 on the base).
  • Changeset: pages that render a Button load about 0.2–0.4 KB less before first paint. Verified: 228–396 B gzip less on the reference pages.
  • Changeset: keyboard focus on a cut label shows it in full as before. Verified for Button: identical keyboard-focus frames, and the unit suites pass.
  • Changeset: a keyboard focus that arrives before the tooltip loads shows it once it loads, if focus is still there. Verified (browser spec, second case), but a press in between no longer drops it (third finding).
  • Changeset: table header cells load their cut headings the same way. Verified: TableHeaderCell.tsx:173-176 and :227.
  • Description: per-page savings (form −396 B, table −260 B, menu −226 B, Button only about −360 B, docs +10 B). Verified within 4 B against this base.
  • Description: keyboard focus on a cut Button shows the full label with no description, Escape closes it, and a caller's tooltip still wins. Verified by the browser spec and the unit suites.
  • Description: mouse and touch are unchanged, and a hover or a press shows nothing. Verified by the unit suites and the browser spec's third case.
  • Description: the new module holds the measurement moved from the truncation tooltip, the caller-tooltip check moved from Button, and a re-export of the undescribed tooltip. Verified, but the check now also applies to header cells (first finding).
  • Description: the first-load hook keeps only the focus handlers and loads the module after first paint. Verified.
  • Description: keyboard focus means :focus-visible plus the shared modality reader, which a Button page already loads, and a text field focused by a pointer still shows nothing. Verified by the first-load graph and the existing header-field test.
  • Description: Button and TableHeaderCell render the returned tooltip, the truncation tooltip loses the moved code, and Text and Heading are unchanged. Verified.
  • Description: the new browser spec covers keyboard focus, a focus during the held module load, Escape, hover and a fitting label. Verified: 3 of 3 pass in Chromium.
  • Description: new unit cases for a press that left focus outside the Button or outside a header's sort control. Verified: both pass.
  • Description: Text's record names the new files, Button's verification row and verified_by name the new spec, and the changeset is a perf patch. Verified.
  • Description: tooltip surfaces load after first paint, and no input starts the load sooner. Verified: only the mount Effect starts it, and a focus only holds itself.
  • Description: Button's cut-label behavior is unchanged. Verified.
  • Description: an earlier design ruling for this item. Not a repository record; not checked.
  • Description: the new spec passes in Chromium and Firefox. Chromium verified; Firefox not re-run.
  • Description: the unit tests pass 1725 of 1725. Verified: 74 files, 1725 tests.
  • Description: tsc, eslint and the knowledge, changeset, import-boundaries and use-client checks are clean. Verified for the Core typecheck, eslint and the knowledge, changeset and use-client checks; the import-boundaries check was not re-run.
  • Description: without the feature a Button page would be 660 B smaller, and about 300 B remains for the hook and its loader. Not re-measured.
  • Description: an overlapping pull request edits only Button's FR17 line. Verified: its record hunk does not touch these lines.

Files:

  • .changeset/button-cut-label-after-paint.md: second finding.
  • docs/specs/components/Button/Button.spec.md: clear.
  • docs/specs/components/Text/Text.spec.md: clear.
  • packages/core/src/Button/Button.truncationTooltip.test.tsx: clear.
  • packages/core/src/Button/Button.tsx: clear.
  • packages/core/src/Button/__tests__/ButtonCutLabel.interaction.browser.spec.ts: clear.
  • packages/core/src/Table/TableHeaderCell.truncationTooltip.test.tsx: clear.
  • packages/core/src/Table/TableHeaderCell.tsx: clear in itself; it inherits the first finding through the hook.
  • packages/core/src/Text/TruncationTooltip.tsx: clear.
  • packages/core/src/Text/cutText.tsx: first finding.
  • packages/core/src/Text/cutTextOnKeyboardFocus.exports.test.ts: clear.
  • packages/core/src/Text/cutTextOnKeyboardFocus.tsx: third finding and the naming suggestion.

Automated review (maintainer link)

Comment thread packages/core/src/Text/cutText.tsx Resolved
…ess drops a held focus

The caller-tooltip check now runs only when the hook's caller asks for it
(Button sets yieldsToCallerTooltip), so a cut sortable heading still shows
on keyboard focus when a caller's tooltip describes the header cell, as
TableHeaderCell FR2 says. A press during the module load now drops the
keyboard focus held for it, so the tooltip does not open after the press;
the held focus is renamed heldFocusRef. The changeset says the measurement,
not the tooltip, now loads after first paint. A header unit case and a
browser case (press during a held load) fail before and pass after.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 30dbe03

@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 cut-label measurement now loads after first paint, saving 183–347 B gzip on pages with a Button while keyboard, mouse and touch behavior stays the same; one fix to the description remains.

  • The description's size figures come from the previous commit: at this head form saves 347 B (not 396 B), table about 231–236 B (not 260 B), menu 183 B (not 226 B) and a Button-only page 310 B (not about 360 B), and with no cut-label code a Button-only page would be about 673–685 B smaller, so the hook and its loader cost over 360 B rather than the ~300 B the description says fits INV10's 307 B allowance; please update the table and the "What stays in the first load" paragraph to this head's figures.

Non-blocking: rewrap the JSDoc line at cutTextOnKeyboardFocus.tsx:64, which runs to 105 columns.

Claims and files checked

Review mode: same-head; reason: none

  • Changed rules (0): none.

Claims:

  • Changeset: the measurement that decides whether a label is cut now loads after first paint with its tooltip, instead of with the Button. Verified: cutTextOnKeyboardFocus.tsx:30 and :88-118; the built Button module reaches the measurement only through import().
  • Changeset: pages that render a Button load about 0.2–0.4 KB less before first paint. Verified: 183–347 B gzip less on the reference pages.
  • Changeset: keyboard focus on a cut label shows it in full, as before. Verified: base and head keyboard-focus frames are identical, and the unit suites pass.
  • Changeset: a keyboard focus that arrives before the tooltip loads shows it once it loads, if focus is still there. Verified: the browser spec's second case.
  • Changeset: table header cells measure their cut headings the same way. Verified: TableHeaderCell.tsx:173-176 and :227.
  • Description: per-page savings of form −396 B, table −260 B, menu −226 B, Button only about −360 B and docs +10 B. False at this head: −347 B, about −231 to −236 B, −183 B, −310 B and +10 B (the blocking issue).
  • Description: Tab onto a cut Button shows the full label with no description, Escape closes it, a press closes it (also during the load), and a caller's tooltip on a Button wins. Verified: the browser spec passes 4 of 4 in Chromium, and the unit suites pass.
  • Description: a cut sortable heading still shows when a caller's tooltip describes the header cell. Verified: the new unit case passes and fails on the previous head; base and head frames are identical.
  • Description: mouse and touch are unchanged, and a hover or a press shows nothing. Verified: the browser spec's fourth case and the unit suites.
  • Description: a keyboard focus before the module loads shows once it loads, if focus is still there. Verified: cutTextOnKeyboardFocus.tsx:99-111 and the browser spec's second case.
  • Description: the new module holds the moved measurement, applies the caller-tooltip check only when the caller asks (Button does), and re-exports the undescribed tooltip. Verified: cutText.tsx:102-120 and Button.tsx:931.
  • Description: the first-load hook keeps only the focus handlers and loads the module after first paint. Verified: only the mount Effect starts the load.
  • Description: keyboard focus means :focus-visible plus the shared modality reader, which a Button page already loads, and a pointer-focused text field shows nothing. Verified: cutTextOnKeyboardFocus.tsx:124-129 and the existing header-field test.
  • Description: Button and TableHeaderCell render the tooltip the hook returns, the truncation tooltip loses the moved code, and Text and Heading are unchanged. Verified: Button.tsx:1216, TableHeaderCell.tsx:227, and the file list.
  • Description: the new browser spec covers keyboard focus, Escape, hover and a fitting label, and holds the module request for the load-window cases. Verified.
  • Description: the press-during-load browser case fails on the previous head and passes now. Verified.
  • Description: the new unit cases for a press that leaves focus outside the Button, a press on a header outside its sort control, and a caller's tooltip on the header cell. Verified: all pass, and the caller-tooltip case fails on the previous head.
  • Description: the Text record names the hook's new files, Button's verification row and verified_by name the new spec, and the changeset is a perf patch. Verified.
  • Description: tooltip surfaces load after first paint, and no input starts that load sooner. Verified.
  • Description: Button's cut-label behavior is unchanged. Verified.
  • Description: an earlier design ruling for this item. Not a repository record, so not checked.
  • Description: the new spec passes 4 of 4 in Chromium and Firefox. Verified in Chromium; the Firefox run was not reproduced.
  • Description: the unit tests pass 1,726 of 1,726. Verified: 74 files, 1,726 tests.
  • Description: the two press cases fail with an earlier latch. Not re-run: that latch is no longer in the code.
  • Description: tsc, eslint and the knowledge, changeset, import-boundaries and use-client checks are clean. Verified.
  • Description: with no cut-label code a Button-only page would be 660 B smaller, this change saves about 360 B, and the remaining ~300 B fits INV10's 307 B allowance. False at this head: about 673–685 B, 310 B and about 363–375 B (the blocking issue).
  • Description: an overlapping pull request edits Button's record on other lines. Verified: its change does not touch these lines.
  • Description: the writing rubric results. Verified: the record lines name files and tests in the present tense.

Files:

  • .changeset/button-cut-label-after-paint.md: clear.
  • docs/specs/components/Button/Button.spec.md: clear.
  • docs/specs/components/Text/Text.spec.md: clear.
  • packages/core/src/Button/Button.truncationTooltip.test.tsx: clear.
  • packages/core/src/Button/Button.tsx: clear.
  • packages/core/src/Button/__tests__/ButtonCutLabel.interaction.browser.spec.ts: clear.
  • packages/core/src/Table/TableHeaderCell.truncationTooltip.test.tsx: clear.
  • packages/core/src/Table/TableHeaderCell.tsx: clear.
  • packages/core/src/Text/TruncationTooltip.tsx: clear.
  • packages/core/src/Text/cutText.tsx: clear.
  • packages/core/src/Text/cutTextOnKeyboardFocus.exports.test.ts: clear.
  • packages/core/src/Text/cutTextOnKeyboardFocus.tsx: the line-length note.

Automated review (maintainer link)

The hook keeps less first-load code: the deferred module now reads the
anchor and measured refs itself, the module is read from its loader instead
of a state copy (it is set before the update that shows a text), and one
handler drops the shown text and any held focus for blur, press and
Escape. A Button-only page now loads 378 B gzip less than main before first
paint (form 413 B, table 293 B, menu 246 B); the cut-label code that stays
in the first load is about 330 B, down from about 708 B on main. Two long
doc lines are rewrapped.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec fbdc420

@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, and it runs once the pull request is marked ready for review. The cut-label measurement now loads after first paint, so pages with a Button load 246–413 B gzip less before first paint, and keyboard, mouse and touch behavior stays the same. The description's size figures now match this head.

Non-blocking: hide in cutTextOnKeyboardFocus.tsx is a new function on every render, and it is the tooltip's onHide, so an open cut-label tooltip re-runs its controlled-open Effect on each re-render; keeping it in useCallback, as before, avoids that.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.

Claims:

  • Changeset: the measurement that decides whether a Button label is cut now loads after first paint with its tooltip, not with the Button. Verified: cutTextOnKeyboardFocus.tsx:29 is the only path to cutText.tsx, loaded from the mount Effect (:70-98), and the Button-only page drops 378 B gzip.
  • Changeset: pages with a Button load about 0.2–0.4 KB less JavaScript before first paint. Verified: 246–413 B gzip less on the reference pages.
  • Changeset: keyboard focus on a cut label shows it in full, as before. Verified: the unit suites pass, and base and head frames after one Tab are identical.
  • Changeset: a keyboard focus that arrives before the tooltip loads shows it once it loads, if focus is still there. Verified: the browser spec's held-load case passes in Chromium and Firefox.
  • Changeset: table header cells measure cut headings the same way. Verified: TableHeaderCell.tsx:173 and :227.
  • Description: the measurement leaves the first load and loads after first paint with the tooltip, which already loaded after mount. Verified: the base truncation module loaded the tooltip in a mount Effect; only the measurement and the caller-tooltip check left the first load.
  • Description: per-page changes of form −413 B, table −293 B, menu −246 B, Button only −378 B and docs +10 B. Verified: −413, −296, −246, −378 and +10 B here (table within 3 B).
  • Description: Tab onto a cut Button shows the full label with no description, Escape closes it, a press closes it (also during the load), and a caller's tooltip on a Button wins. Verified: the browser spec passes 4 of 4 in Chromium and Firefox, and the unit suites pass.
  • Description: a cut sortable heading still shows when a caller's tooltip describes the header cell. Verified: the new unit case passes.
  • Description: a keyboard focus before the module loads shows once it loads, if focus is still there. Verified: cutTextOnKeyboardFocus.tsx:80-91 and the browser spec.
  • Description: mouse and touch are unchanged, and a hover or a press shows nothing. Verified: the browser spec's fourth case, identical hover frames, and the unit suites.
  • Description: the new module holds the moved measurement, applies the caller-tooltip check only when the caller asks (Button does), and re-exports the undescribed tooltip. Verified: cutText.tsx:87-126 and Button.tsx:931.
  • Description: the first-load hook keeps only the focus handlers, loads the module after first paint, treats focus as keyboard focus through :focus-visible and the shared modality reader (already on Button pages through the tooltip hook), keeps a pointer-focused field silent, and returns the tooltip to render. Verified: cutTextOnKeyboardFocus.tsx:67, :103-123 and :133-141; the tooltip hook reaches the reader through its touch trigger; the pointer-focused-field test passes.
  • Description: Button and the header cell render the returned tooltip, the truncation module loses the moved code, and Text and Heading are unchanged. Verified: Button.tsx:1216, TableHeaderCell.tsx:227 and the file list.
  • Description: the new browser spec covers keyboard focus, Escape, hover and a fitting label, and holds the module request for the load-window case. Verified.
  • Description: the press-during-load browser case fails at an earlier commit and passes now. Verified: it passes here, and the test and that commit are unchanged since its earlier red-first run.
  • Description: new unit cases for a press that leaves focus outside the Button, a press on a header outside its sort control, and a caller's tooltip on the header cell (the last failing at an earlier commit). Verified: all pass, and the caller case's red-first run carries over unchanged.
  • Description: the Text record names the hook's new files, Button's verification row and verified-by list name the new spec, and the changeset is a perf patch. Verified.
  • Description: tooltip code loads after first paint, and no input starts that load sooner. Verified: only the mount Effect calls the loader; a focus is held, not loaded.
  • Description: Button's cut-label behavior is unchanged. Verified.
  • Description: an earlier design ruling says the measurement loads with the tooltip and Button keeps only a small focus handler. The code matches; the ruling itself is not in the repository.
  • Description: the new spec passes 4 of 4 in Chromium and Firefox. Verified: 4 of 4 in each.
  • Description: the unit tests pass 1,726 of 1,726, and the import-boundaries check holds. Verified.
  • Description: the two new press cases fail with the earlier press latch. Verified: both fail on that commit with these tests.
  • Description: tsc, eslint and the knowledge, changeset, import-boundaries and use-client checks are clean. Verified.
  • Description: with the hook stubbed a Button-only page is 708 B smaller, this change saves 378 B, so about 330 B stays, and no first-load code is added. Consistent: a no-op hook here gives 658 B (about 280 B stays), so the figure depends on the stub; every page with a Button shrinks, and docs changes only in gzip (+10 B, 0 B minified).
  • Description: an overlapping pull request edits Button's record on other lines. Verified: it changes the FR17 rows, and this one changes the FR18 verification row and the verified-by list.
  • Description: the writing rubric results. Verified: the record lines name files and tests in the present tense.

Files:

  • .changeset/button-cut-label-after-paint.md: clear.
  • docs/specs/components/Button/Button.spec.md: clear.
  • docs/specs/components/Text/Text.spec.md: clear.
  • packages/core/src/Button/Button.truncationTooltip.test.tsx: clear.
  • packages/core/src/Button/Button.tsx: clear.
  • packages/core/src/Button/__tests__/ButtonCutLabel.interaction.browser.spec.ts: clear.
  • packages/core/src/Table/TableHeaderCell.truncationTooltip.test.tsx: clear.
  • packages/core/src/Table/TableHeaderCell.tsx: clear.
  • packages/core/src/Text/TruncationTooltip.tsx: clear.
  • packages/core/src/Text/cutText.tsx: clear.
  • packages/core/src/Text/cutTextOnKeyboardFocus.exports.test.ts: clear.
  • packages/core/src/Text/cutTextOnKeyboardFocus.tsx: the non-blocking hide note.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 19, 2026 11:10

@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: one required CI test fails on this head because of this change.

  • Found by CI: scripts/core-single-bundle.test.mjs ("keeps the bottom sheet out of the startup chunks of a code-split app") fails because it starts its startup walk at the first esbuild output with an entryPoint, and the new import('./cutText') reorders the outputs so that this is PowerSearchBottomSheet's lazy chunk; start the walk at the app's own entry (outputs[file].entryPoint?.endsWith('main.jsx')), since the app's real startup chunks hold no BottomSheet.

The rest holds: pages with a Button load 246–413 B gzip less before first paint, and keyboard, mouse and touch behavior stays the same. Non-blocking: hide in cutTextOnKeyboardFocus.tsx is a new function on every render and is the tooltip's onHide, so an open cut-label tooltip re-runs its controlled-open Effect on each re-render; keeping it in useCallback, as before, avoids that.

Claims and files checked

Review mode: same-head; reason: none

  • Changed rules (0): none.

Claims:

  • Changeset: the measurement that decides whether a Button label is cut now loads after first paint with its tooltip, not with the Button. Verified: the hook's mount Effect is the only path to the new module (cutTextOnKeyboardFocus.tsx:29, :70-98), and the Button-only page drops 378 B gzip.
  • Changeset: pages with a Button load about 0.2–0.4 KB less JavaScript before first paint. Verified: 246–413 B gzip less on the reference pages.
  • Changeset: keyboard focus on a cut label shows it in full, as before. Verified: base and head frames after one Tab are identical, and the unit suites pass.
  • Changeset: a keyboard focus that arrives before the tooltip loads shows it once it loads, if focus is still there. Verified: the browser spec's held-load case passes in Chromium and Firefox.
  • Changeset: table header cells measure cut headings the same way. Verified: TableHeaderCell.tsx:173 and :227.
  • Description: the measurement leaves the first load and joins the tooltip, which already loaded after mount. Verified: the base hook loaded the tooltip in a mount Effect; only the measurement and the caller-tooltip check left the first load.
  • Description: per-page changes of form −413 B, table −293 B, menu −246 B, Button only −378 B and docs +10 B. Verified within 3 B (table −296 B).
  • Description: Tab onto a cut Button shows the full label with no description, Escape closes it, a press closes it (also during the load), and a caller's tooltip on a Button wins. Verified: frames and probes for Tab and Escape, the browser spec in Chromium and Firefox, and the unit suites.
  • Description: a cut sortable heading still shows when a caller's tooltip describes the header cell. Verified: the new unit case passes.
  • Description: mouse and touch are unchanged, and a hover or a press shows nothing. Verified: identical hover frames with no tooltip, and the browser spec's fourth case.
  • Description: the new module holds the moved measurement, applies the caller-tooltip check only when the caller asks (Button does), and re-exports the undescribed tooltip. Verified: cutText.tsx:87-126 and Button.tsx:931.
  • Description: the first-load hook keeps only the focus handlers, loads the module after first paint, reads keyboard focus through :focus-visible and the shared modality reader, keeps a pointer-focused field silent, and returns the tooltip to render. Verified: cutTextOnKeyboardFocus.tsx:67, :103-123 and :132-141; the pointer-focused-field test passes.
  • Description: Button and the header cell render the returned tooltip, the truncation module loses the moved code, and Text and Heading are unchanged. Verified: Button.tsx:1216, TableHeaderCell.tsx:227 and the file list.
  • Description: the new browser spec covers keyboard focus, Escape, hover and a fitting label, and holds the module request for the load-window case. Verified.
  • Description: the press-during-load browser case and the caller-described header case fail at an earlier commit and pass now, and the two new press cases fail with the earlier press latch. Verified by red-first runs on those commits.
  • Description: the Text record names the hook's new files, Button's verification row and verified-by list name the new spec, and the changeset is a perf patch. Verified.
  • Description: tooltip code loads after first paint, and no input starts that load sooner. Verified: only the mount Effect calls the loader; a focus is held, not loaded.
  • Description: Button's cut-label behavior is unchanged. Verified.
  • Description: an earlier design ruling says the measurement loads with the tooltip and Button keeps only a small focus handler. The code matches; the ruling itself is not in the repository.
  • Description: the new spec passes 4 of 4 in Chromium and Firefox. Verified.
  • Description: unit tests for Button, Table, Text, Heading, Tooltip and ToggleButton pass 1,726 of 1,726, and the import-boundaries check holds. Verified; CI's UI tests pass too.
  • Description: tsc, eslint and the knowledge, changeset, import-boundaries and use-client checks are clean. Verified; CI's lint and typecheck pass.
  • Description: with the hook stubbed a Button-only page is 708 B smaller, so about 330 B of cut-label code stays, and this change adds no first-load code. Consistent: a no-op hook gives 658 B (about 280 B stays); every page with a Button shrinks, and docs changes only in gzip.
  • Description: an overlapping pull request edits Button's record on other lines. Verified: it edits the FR17 rows; this one edits the FR18 row and the verified-by list.
  • Description: the writing rubric results. Verified: the record lines name files and tests in the present tense.

Files:

  • .changeset/button-cut-label-after-paint.md: clear.
  • docs/specs/components/Button/Button.spec.md: clear.
  • docs/specs/components/Text/Text.spec.md: clear.
  • packages/core/src/Button/Button.truncationTooltip.test.tsx: clear.
  • packages/core/src/Button/Button.tsx: clear.
  • packages/core/src/Button/__tests__/ButtonCutLabel.interaction.browser.spec.ts: clear.
  • packages/core/src/Table/TableHeaderCell.truncationTooltip.test.tsx: clear.
  • packages/core/src/Table/TableHeaderCell.tsx: clear.
  • packages/core/src/Text/TruncationTooltip.tsx: clear.
  • packages/core/src/Text/cutText.tsx: clear.
  • packages/core/src/Text/cutTextOnKeyboardFocus.exports.test.ts: clear.
  • packages/core/src/Text/cutTextOnKeyboardFocus.tsx: its new import() reorders the code-split bundle and breaks the bundle test's entry choice (Found by CI); the non-blocking hide note.

Automated review (maintainer link)

…abel hide keeps one identity

With code splitting, esbuild marks each dynamic import as an entry point
too. The new import of the cut-text module reordered the outputs, so the
bundle test's startup walk began at the search sheet's lazy chunk and
found the bottom sheet there. The walk now starts at the output whose
entry point is the app's main.jsx, and the real startup chunks hold no
bottom sheet. The keyboard cut-label hook's hide is the open tooltip's
onHide, so it is now a stable callback and an open tooltip no longer
re-runs its controlled-open Effect on each render.
@cixzhang
cixzhang marked this pull request as draft November 19, 2026 12:11
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 19, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 9dc702f

@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: every check passes on this head except the required test check, which fails in test-node (1/9) because only 128 of 143 interaction specs have a recorded Chromium time, under the 90% floor. main fails the same check (127 of 142) since an untimed spec landed there, and this pull request's own new spec is timed, so the fix belongs on main: once #13238 or #13193 lands, merge main here so CI runs again.

Non-blocking: the description's size table is labelled at an earlier commit; with this code the changes are form −376 B, table −262 B, menu −227 B, Button only −387 B and docs +1 B gzip.

Claims and files checked

Review mode: same-head; reason: none

  • Changed rules (0): none since the previous review of this head.
  • Claims:
    • Changeset: the measurement that decides whether a Button label is cut loads after first paint with its tooltip, not with the Button. Verified: the only load is the mount Effect (cutTextOnKeyboardFocus.tsx:71-99), and onFocus never loads (:117-124).
    • Changeset: pages with a Button load about 0.2–0.4 KB less before first paint. Verified: 227–387 B gzip less on the form, menu, table and Button-only pages for this patch.
    • Changeset: keyboard focus shows a cut label in full as before, and a focus made before the tooltip loads shows once it loads if focus is still there. Verified: pixel-identical base and head frames after one Tab, the replay check at cutTextOnKeyboardFocus.tsx:83, and the browser spec's load-window case in Chromium and WebKit on this head.
    • Changeset: table header cells measure their cut headings the same way. Verified: TableHeaderCell.tsx:180-183 and :234, and the header truncation suite (14 of 14 on this head).
    • Description: the measurement leaves the first load and loads after first paint with the cut-label tooltip, which already loaded after mount. Verified: the base hook loaded the tooltip module in a mount Effect; this code loads cutText.tsx the same way.
    • Description: less JavaScript before first paint on every Button page, with a per-page table. The direction is verified; the figures are from an earlier commit (non-blocking note).
    • Description: the keyboard tooltip adds no description; Escape closes it; a press closes it, also one made during the load; a caller's tooltip on a Button wins. Verified: the frame probes (no aria-describedby, no tooltip after Escape), the Button truncation suite (15 of 15), the browser spec's press case, and cutText.tsx:118 with Button.tsx:937.
    • Description: a cut sortable heading still shows when a caller's tooltip describes the header cell. Verified: the header cell does not set the caller option, and the new header case passes on this head.
    • Description: a keyboard focus that arrives before the module loads shows once it loads, if focus is still there. Verified: cutTextOnKeyboardFocus.tsx:81-92 and the browser spec.
    • Description: mouse and touch are unchanged; a hover or a press shows nothing. Verified: pixel-identical hover frames with no tooltip, and a press only closes (cutTextOnKeyboardFocus.tsx:146).
    • Description: the deferred module holds the moved measurement and the caller-tooltip check, applied only when the caller asks (Button does), and re-exports the undescribed tooltip. Verified: cutText.tsx:19-80, :87-95, :104-124 and :126.
    • Description: the first-load hook keeps only the focus handlers, loads the module after first paint, counts keyboard focus by :focus-visible and the shared modality reader, and returns the tooltip element. Verified: cutTextOnKeyboardFocus.tsx:30 and :66-147.
    • Description: a Button page already loads the shared modality reader through its tooltip hook. Verified: useTooltip.tsx:29 imports the same module.
    • Description: a text field a pointer focused still shows nothing. Verified: the modality check at cutTextOnKeyboardFocus.tsx:113 and the pointer-focused-field header case.
    • Description: Button and the header cell render the returned tooltip, the old module loses only the moved code, and Text and Heading are unchanged. Verified: Button.tsx:1222 and TableHeaderCell.tsx:234; Text and Heading are not in the diff.
    • Description: the new browser spec covers keyboard focus, Escape, hover and a fitting label, and holds the module's request for the load-window cases. Verified: its four cases pass in Chromium and WebKit in CI on this head.
    • Description: the new press and caller-tooltip cases fail on the earlier commits they guard. Consistent: those commits had the defects these cases target; not rerun here.
    • Description: unit tests pass, the import-boundaries check holds, and typecheck, lint and the repository checks are clean. Verified: the touched suites pass 177 of 177 on this head, and CI's lint and typecheck pass on this head.
    • Description: the code-split bundle test starts its walk at the app's own entry. Verified: scripts/core-single-bundle.test.mjs:164-167; it passes 3 of 3 in CI on this head.
    • Description: the hook's hide callback keeps one identity. Verified: cutTextOnKeyboardFocus.tsx:101-104.
    • Description: about 330 B of cut-label code stays in the first load, and the change adds none. Consistent: the Button-only page is 387 B smaller with this patch.
    • Description: on the base every text Button rendered again at boot when the tooltip module resolved, and this code does not. Verified in code: the base set tooltip state after mount for each such Button; this code sets state only for a held focus. The app timings are the author's own.
    • Description: the new browser spec passes in real Chromium and Firefox. Verified in Chromium and WebKit in CI on this head; the Firefox run is the author's own.
    • Description: Button's record stays as main has it, the Text record names the new files, and the release note is a [perf] patch. Verified: Button's record is not in the diff; Text.spec.md:86-89; the changeset.
    • Description: an overlapping merged change also edited Button's record, and this pull request no longer changes it. Verified.
    • Description: the governing rules are the after-paint tooltip load and Button's unchanged keyboard tooltip requirement. Verified against the current records.
    • The pull request records the new interaction spec's Chromium time. Verified: .github/playwright-leg-durations.json:14.
  • Files:
    • .changeset/button-cut-label-after-paint.md: clear
    • .github/playwright-leg-durations.json: clear
    • docs/specs/components/Text/Text.spec.md: clear
    • packages/core/src/Button/Button.truncationTooltip.test.tsx: clear
    • packages/core/src/Button/Button.tsx: clear
    • packages/core/src/Button/__tests__/ButtonCutLabel.interaction.browser.spec.ts: clear
    • packages/core/src/Table/TableHeaderCell.truncationTooltip.test.tsx: clear
    • packages/core/src/Table/TableHeaderCell.tsx: clear
    • packages/core/src/Text/TruncationTooltip.tsx: clear
    • packages/core/src/Text/cutText.tsx: clear
    • packages/core/src/Text/cutTextOnKeyboardFocus.exports.test.ts: clear
    • packages/core/src/Text/cutTextOnKeyboardFocus.tsx: clear
    • scripts/core-single-bundle.test.mjs: clear

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 21, 2026 07:28
github-actions Bot added a commit that referenced this pull request Nov 21, 2026
@cixzhang cixzhang added ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) lane:1 Astryx fix-loop lane 1 owns this labels Nov 21, 2026
@cixzhang
cixzhang marked this pull request as draft November 21, 2026 09:47
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 165d114

@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. CI passes on this head.

Non-blocking: the description's size table is labelled at an earlier commit; with this code the first-load changes are form −383 B, table −257 B, menu −228 B, Button only −387 B and docs +1 B gzip.

Claims and files checked

Review mode: same-head; reason: none

  • Changed rules (0): none since the previous review.
  • Claims:
    • Changeset: the measurement that decides whether a Button label is cut loads after first paint with its tooltip, not with the Button. Verified: the only load is the mount Effect (cutTextOnKeyboardFocus.tsx:71-99), and onFocus never loads (:117-124).
    • Changeset: pages with a Button load about 0.2–0.4 KB less before first paint. Verified: 228–387 B gzip less on the menu, table, form and Button-only pages.
    • Changeset: keyboard focus shows a cut label in full as before, and a focus made before the tooltip loads shows once it loads if focus is still there. Verified: pixel-identical base and head frames after one Tab, the replay check at cutTextOnKeyboardFocus.tsx:83, and the browser spec's load-window case passing in Chromium and WebKit.
    • Changeset: table header cells measure their cut headings the same way. Verified: TableHeaderCell.tsx:177-183 and :234, and the header truncation suite (14 of 14).
    • Title and description: the measurement leaves the first load and loads after first paint with the cut-label tooltip, which already loaded after mount. Verified: the base hook loaded the tooltip module in a mount Effect; this code loads cutText.tsx the same way.
    • Description: less JavaScript before first paint on every Button page, with a per-page table. The direction is verified; the figures are from an earlier commit (non-blocking note above).
    • Description: the keyboard tooltip adds no description; Escape closes it; a press closes it, also one made during the load; a caller's tooltip on a Button wins. Verified: the browser spec's Escape and press cases, the frame probes (no aria-describedby), the Button truncation suite (15 of 15), and cutText.tsx:118 with Button.tsx:937.
    • Description: a cut sortable heading still shows when a caller's tooltip describes the header cell. Verified: the header cell does not set the caller option, and the new header case passes.
    • Description: a keyboard focus that arrives before the module loads shows once it loads, if focus is still there. Verified: cutTextOnKeyboardFocus.tsx:81-92 and the browser spec.
    • Description: mouse and touch are unchanged; a hover or a press shows nothing. Verified: identical hover frames with no tooltip, the spec's hover case, and a press that only closes (cutTextOnKeyboardFocus.tsx:146).
    • Description: the deferred module holds the moved measurement and the caller-tooltip check, applied only when the caller asks (Button does), and re-exports the undescribed tooltip. Verified: cutText.tsx:19-80, :87-95, :104-124 and :126.
    • Description: the first-load hook keeps only the focus handlers, loads the module after first paint, counts keyboard focus by :focus-visible and the shared modality reader, and returns the tooltip element. Verified: cutTextOnKeyboardFocus.tsx:30 and :66-147.
    • Description: a Button page already loads the shared modality reader through its tooltip hook. Verified: useTooltip.tsx:29 imports the same module.
    • Description: a text field a pointer focused still shows nothing. Verified: the modality check at cutTextOnKeyboardFocus.tsx:113 and the pointer-focused-field header case.
    • Description: Button and the header cell render the returned tooltip, the old module loses only the moved code, and Text and Heading are unchanged. Verified: Button.tsx:1222 and TableHeaderCell.tsx:234; Text and Heading are not in the diff.
    • Description: the new browser spec covers keyboard focus, Escape, hover and a fitting label, and holds the module's request for the load-window cases. Verified: its four cases pass in Chromium and WebKit in CI.
    • Description: the new press and caller-tooltip cases fail on the earlier commits they guard. Verified in code, not rerun: those commits applied the caller-tooltip check to every anchor, left a held focus set after a press, and kept a press latch that skipped the next keyboard focus.
    • Description: unit tests pass, the import-boundaries check holds, and typecheck, lint and the repository checks are clean. Verified: CI's unit shards, typecheck and lint pass on this head.
    • Description: the code-split bundle test starts its walk at the app's own entry. Verified: scripts/core-single-bundle.test.mjs:164-167; it passes 3 of 3 in CI.
    • Description: the hook's hide callback keeps one identity. Verified: cutTextOnKeyboardFocus.tsx:101-104.
    • Description: about 330 B of cut-label code stays in the first load, and the change adds none. Consistent: the Button-only page is 387 B smaller.
    • Description: on the base every text Button rendered again at boot when the tooltip module resolved, and this code does not. Verified in code: the base set tooltip state after mount for each such Button; this code sets state only for a held focus. The app timings are the author's own.
    • Description: the new browser spec passes in real Chromium and Firefox. Chromium verified in CI, which also passes it in WebKit; the Firefox run is the author's own.
    • Description: Button's record stays as main has it, the Text record names the new files, and the release note is a [perf] patch. Verified: Button's record is not in the diff; Text.spec.md:86-90; the changeset.
    • Description: an overlapping merged change also edited Button's record, and this pull request no longer changes it. Verified.
    • Description: the governing rules are the after-paint tooltip load and Button's unchanged keyboard tooltip requirement. Verified against the current records.
    • The pull request records the new interaction spec's Chromium time. Verified: .github/playwright-leg-durations.json:14; the recorded-times test passes in CI.
  • Files:
    • .changeset/button-cut-label-after-paint.md: clear
    • .github/playwright-leg-durations.json: clear
    • docs/specs/components/Text/Text.spec.md: clear
    • packages/core/src/Button/Button.truncationTooltip.test.tsx: clear
    • packages/core/src/Button/Button.tsx: clear
    • packages/core/src/Button/__tests__/ButtonCutLabel.interaction.browser.spec.ts: clear
    • packages/core/src/Table/TableHeaderCell.truncationTooltip.test.tsx: clear
    • packages/core/src/Table/TableHeaderCell.tsx: clear
    • packages/core/src/Text/TruncationTooltip.tsx: clear
    • packages/core/src/Text/cutText.tsx: clear
    • packages/core/src/Text/cutTextOnKeyboardFocus.exports.test.ts: clear
    • packages/core/src/Text/cutTextOnKeyboardFocus.tsx: clear
    • scripts/core-single-bundle.test.mjs: clear

Automated review (maintainer link)

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

Copy link
Copy Markdown
Contributor Author

/approve-spec 45ab9ca

@cixzhang
cixzhang marked this pull request as ready for review November 21, 2026 12:55
github-actions Bot added a commit that referenced this pull request Nov 21, 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.

Approved. CI passes on this head.

Non-blocking: the description's size table is labelled at an earlier commit; with this code the first-load changes are form −383 B, table −257 B, menu −225 B, Button only −387 B and docs +1 B gzip.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none since the previous review.
  • Claims:
    • Changeset: the measurement that decides whether a Button label is cut loads after first paint with its tooltip, not with the Button. Verified: the only load is the mount Effect (cutTextOnKeyboardFocus.tsx:71-99), and onFocus never loads (:105-125).
    • Changeset: pages with a Button load about 0.2–0.4 KB less before first paint. Verified: 225–387 B gzip less on the menu, table, form and Button-only pages.
    • Changeset: keyboard focus shows a cut label in full as before, and a focus made before the tooltip loads shows once it loads if focus is still there. Verified: pixel-identical base and head frames after one Tab, the replay check at cutTextOnKeyboardFocus.tsx:83, and the browser spec's load-window case passing in Chromium and WebKit.
    • Changeset: table header cells measure their cut headings the same way. Verified: TableHeaderCell.tsx:180-183 and :234, and the header truncation suite (14 of 14).
    • Title and description: the measurement leaves the first load and loads after first paint with the cut-label tooltip, which already loaded after mount. Verified: the base hook loaded the tooltip module in a mount Effect; this code loads cutText.tsx the same way.
    • Description: less JavaScript before first paint on every Button page, with a per-page table. The direction is verified; the figures are from an earlier commit (non-blocking note above).
    • Description: the keyboard tooltip adds no description; Escape closes it; a press closes it, also one made during the load; a caller's tooltip on a Button wins. Verified: the browser spec's Escape and press cases, the frame probes (no aria-describedby), the Button truncation suite (15 of 15), and cutText.tsx:118 with Button.tsx:937.
    • Description: a cut sortable heading still shows when a caller's tooltip describes the header cell. Verified: the header cell does not set the caller option, and the new header case passes.
    • Description: a keyboard focus that arrives before the module loads shows once it loads, if focus is still there. Verified: cutTextOnKeyboardFocus.tsx:77-88 and the browser spec.
    • Description: mouse and touch are unchanged; a hover or a press shows nothing. Verified: identical hover frames with no tooltip, the spec's hover case, and a press that only closes (cutTextOnKeyboardFocus.tsx:146).
    • Description: the deferred module holds the moved measurement and the caller-tooltip check, applied only when the caller asks (Button does), and re-exports the undescribed tooltip. Verified: cutText.tsx:20-80, :87-95, :104-124 and :126.
    • Description: the first-load hook keeps only the focus handlers, loads the module after first paint, counts keyboard focus by :focus-visible and the shared modality reader, and returns the tooltip element. Verified: cutTextOnKeyboardFocus.tsx:30 and :66-147.
    • Description: a Button page already loads the shared modality reader through its tooltip hook. Verified: useTooltip.tsx:29 imports the same module.
    • Description: a text field a pointer focused still shows nothing. Verified: the modality check at cutTextOnKeyboardFocus.tsx:113 and the pointer-focused-field header case.
    • Description: Button and the header cell render the returned tooltip, the old module loses only the moved code, and Text and Heading are unchanged. Verified: Button.tsx:1222 and TableHeaderCell.tsx:234; Text and Heading are not in the diff.
    • Description: the new browser spec covers keyboard focus, Escape, hover and a fitting label, and holds the module's request for the load-window cases. Verified: its four cases pass in Chromium and WebKit in CI.
    • Description: the new press and caller-tooltip cases fail on the earlier commits they guard. Verified in code, not rerun: those commits applied the caller-tooltip check to every anchor, left a held focus set after a press, and kept a press latch that skipped the next keyboard focus.
    • Description: unit tests pass, the import-boundaries check holds, and typecheck, lint and the repository checks are clean. Verified: CI's unit shards, typecheck and lint pass on this head, and lint reports that the import boundaries hold.
    • Description: the code-split bundle test starts its walk at the app's own entry. Verified: scripts/core-single-bundle.test.mjs:165-167; it passes 3 of 3 in CI and in this review.
    • Description: the hook's hide callback keeps one identity. Verified: cutTextOnKeyboardFocus.tsx:101-104.
    • Description: about 330 B of cut-label code stays in the first load, and the change adds none. Consistent: the Button-only page is 387 B smaller.
    • Description: on the base every text Button rendered again at boot when the tooltip module resolved, and this code does not. Verified in code: the base set tooltip state after mount for each such Button; this code sets state only for a held focus. The app timings are the author's own.
    • Description: the new browser spec passes in real Chromium and Firefox. Chromium verified in CI, which also passes it in WebKit; the Firefox run is the author's own.
    • Description: Button's record stays as main has it, the Text record names the new files, and the release note is a [perf] patch. Verified: Button's record is not in the diff; Text.spec.md:86-90; the changeset.
    • Description: an overlapping merged change also edited Button's record, and this pull request no longer changes it. Verified.
    • Description: the governing rules are the after-paint tooltip load and Button's unchanged keyboard tooltip requirement. Verified against the current records.
  • Files:
    • .changeset/button-cut-label-after-paint.md: clear
    • docs/specs/components/Text/Text.spec.md: clear
    • packages/core/src/Button/Button.truncationTooltip.test.tsx: clear
    • packages/core/src/Button/Button.tsx: clear
    • packages/core/src/Button/__tests__/ButtonCutLabel.interaction.browser.spec.ts: clear
    • packages/core/src/Table/TableHeaderCell.truncationTooltip.test.tsx: clear
    • packages/core/src/Table/TableHeaderCell.tsx: clear
    • packages/core/src/Text/TruncationTooltip.tsx: clear
    • packages/core/src/Text/cutText.tsx: clear
    • packages/core/src/Text/cutTextOnKeyboardFocus.exports.test.ts: clear
    • packages/core/src/Text/cutTextOnKeyboardFocus.tsx: clear
    • scripts/core-single-bundle.test.mjs: clear

Automated review (maintainer link)

@cixzhang
cixzhang merged commit 95dd7cd into main Nov 21, 2026
160 checks passed
cixzhang added a commit that referenced this pull request Nov 21, 2026
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.
cixzhang added a commit that referenced this pull request Nov 21, 2026
…-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.
cixzhang added a commit that referenced this pull request Nov 21, 2026
… focus (#11933)

* perf(Table): a default cell measures its truncation on first hover or 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.

* fix(Table): default cells still load the Tooltip code after first paint

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.

* fix(Text): text that measures on interest loads the Tooltip after the 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.

* fix(Text): texts that measure on interest share one after-paint Tooltip 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.

* fix(Table): a measured cell follows its content, and no hover hurries the Tooltip load

- A default cell whose tooltip has been wanted re-measures on a content
  change, so an open tooltip follows the text (Text FR4).
- The tooltip interest picks the after-paint preload whenever the text
  measures on interest, so a hover on a cut-off cell joins it instead of
  loading at once (import-boundaries DEC-4). A failed preload lets the
  next text try again.
- useTruncation keeps its doc comment; the changeset files under
  Performance.
- Text PR1 defers the Tooltip module's load to DEC-4.

* refactor(Text): measuring on interest is a mode of the truncation hook

Text kept its own measurement, answer and content observer beside its
truncation hook. The mode now lives in useTruncation.ts: an internal
useTruncationMeasure measures and observes nothing at mount, measures
when the tooltip interest calls measure(), and follows content changes
after that. The public useTruncation keeps its signature and return.
Text calls the hook once.

* fix(Text): a cell that a resize cuts off again answers its next hover

A cell's tooltip that had read a hover unmounted while a later hover
found the text fitting. When a resize cut the text off again, the
tooltip mounted closed, because the interest still counted as read.
Measuring on interest now clears that when the text becomes truncated
again, so the remounted tooltip reads the new hover. File headers name
the after-paint load and the internal hook.

* fix(Text): a cell cut off by a resize after its text changed answers its next hover

The reset compared with the last interaction's measurement, which a
content change does not update. It now compares with the rendered answer:
a hover that measures the text truncated while no tooltip shows clears
the read interaction.

* Merge remote-tracking branch 'origin/main' into l0/table-cell-measure-on-interest

* fix(Text): a table header's keyboard-focus tooltip loads its module after the first paint

Since main added the header cell's cut-heading tooltip, it loaded the
Tooltip module right after the first render. Tooltip code loads after the
first paint (DEC-4), so it now shares the page's after-paint preload with
the cells. The counted-load test helper waits a frame and a task before it
counts, so an earlier test's preload cannot land inside the count.

* Merge branch 'main' into l0/table-cell-measure-on-interest

* fix(Text): the after-paint tooltip preload uses the shared module loader

The page-wide preload was a module-scope let, which the shared-identity
check (AST-110 FR3) rejects. A second createModuleLoader holds it with the
same once-per-page and retry-after-failure behavior, and stays per copy of
Core like the tooltip module it loads.

* Merge branch 'main' into l0/table-cell-measure-on-interest

* Merge branch 'main' into l0/table-cell-measure-on-interest

* Merge branch 'main' into l0/table-cell-measure-on-interest

* Merge branch 'main' into l0/table-cell-measure-on-interest

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.

* test(Table): the cells' Tooltip-load tests leave out the header's cut-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.

* test(Table): the two after-paint load waits allow 3 s, as the Text suite's do

A loaded shard can take more than the 1 s default before the after-paint
Tooltip load lands.
@github-actions
github-actions Bot deleted the perf/cut-label-after-paint branch November 22, 2026 06:04
cixzhang added a commit that referenced this pull request Nov 22, 2026
Resolves Button.tsx and useTooltip.tsx against #12443 and #11831's line: the cut label's tooltip comes from main's lazy cutText module, and its caller-tooltip check (now in cutText.tsx) also counts a description's hidden copy and mounted tooltip content. useTooltip keeps lazyMount, keepsMountAfterShow and main's getInvoker. SideNav's labelTooltipOf finds the tooltip through the trigger's description.
cixzhang added a commit that referenced this pull request Nov 24, 2026
* perf(Tooltip): the layer mounts at the tooltip's first show

Every Tooltip mounted its layer with its trigger, so a table with a
tooltip on every row mounted hundreds of closed layers and froze for
seconds. The layer now mounts at the first hover, focus, tap or show(),
in the same commit as that show, and then stays. Until then the
trigger's aria-describedby names hidden text with the same content, so
screen readers read the same description; the hidden text and the layer
are never in the page together. Tests that read the closed layer before
any interaction now read the tooltip after it.

* fix(Tooltip): a plain hidden copy describes the trigger until the first show

The stand-in description no longer plays the tooltip role, so the page
holds one tooltip per trigger. It renders through a portal into the
body of the trigger's document, so it sits in no paragraph and no
sibling rule. A server render carries no description and no reference
until it hydrates. TOOLTIP_PATTERN's rows that read the tooltip apply
once it has shown, and a new row checks the hidden copy before then.

* fix(Tooltip): the copy follows the layer's own mount and the trigger's root

The swap from the hidden copy to the tooltip reads the layer runtime's
mount store, so a show that waits for its trigger's box keeps the copy
until the layer mounts. A trigger in a shadow root keeps the copy in
that root. Switch and the MultiSelector status button leave an empty
describedby off. TOOLTIP_PATTERN checks the computed description
before the first show.

* Merge remote-tracking branch 'refs/remotes/l4/main-new' into lane4/tooltip-mount-on-first-intent

* test: read a tooltip's description before its first show

Tests that read a tooltip's layer before it opened now read the
trigger's description: the hidden copy until the layer mounts, then the
tooltip. Tests that need the open tooltip show it first. Each test keeps
its user-visible assertion.

* fix(Tooltip): the status-icon and date-input callers leave an empty describedby off

The field status-icon button and the DateInput, DateTimeInput and
DateRangeInput disabled-reason buttons no longer write an empty
aria-describedby in server and hydrating markup. The changeset states the
measured effect.

* Merge commit '88c4e0a8a7d62d66d678bb457e5d05edae3f88bc' into lane4/tooltip-mount-on-first-intent

* fix(Tooltip): a shadow-root trigger in another window keeps its copy in its root

The description root is found by node type, so a shadow root whose host
moved into an iframe's or another window's document still holds the
hidden copy, where the trigger's aria-describedby can name it.

* fix(Tooltip): a trigger that attaches again in the page moves its copy back

The trigger's ref callback now clears the stored description root when
the trigger attaches in the page's own body, so a hook trigger that
moves out of a shadow root or another window names a copy the page
holds.

* fix(Tooltip): the trigger's description root changes state only when it changes

Fields attach their tooltip through an inline ref at every commit, so
setting the root on every attach added a commit per render and left a
native TimeInput showing a cleared rejection. The ref callback now sets
it only when the root differs from the committed one.

* perf(CheckboxInput): the disabled-message tooltip runs only while it can show

Every checkbox called useTooltip, though the tooltip shows only when the checkbox is disabled and has a disabledMessage. On 1,000 checkboxes at 6x CPU in Chromium, useTooltip and its hooks were about a fifth of render and commit. The tooltip now lives in a child component that mounts only while the message can show; it attaches to the row and the checkbox, and reports its description id for the input's aria-describedby (an empty id is left out).

* fix(CheckboxInput): the disabled reason describes the checkbox in the server markup

The reason renders once in a visually hidden element whose id the input names in aria-describedby during render, so it is there before hydration and before the tooltip mounts or shows (spec:AST-013 FR9; component:CheckboxInput FR4, FR6). The tooltip still mounts only while the reason can show; its text is hidden from assistive technology, so the reason describes the checkbox once. An SSR test checks the server markup and a clean hydration.

* fix(CheckboxInput): the disabled reason renders once

The visually hidden copy describes the input in the server markup and until the tooltip's text is in the document; then the tooltip describes it and the copy goes, so a disabled checkbox with a reason renders the text once, as on main. The changeset names the server-markup fix.

* fix(CheckboxInput): hand the description to the tooltip from its surface's own ref

useTooltip gains an internal onSurfaceMount callback, driven by the layer surface's ref, so CheckboxInput learns when the tooltip text is in the document without a document observer. The per-checkbox MutationObserver is gone.

* refactor(Tooltip): keep onSurfaceMount off the public TooltipOptions

The surface callback moves to useTooltipInternal(options, {onSurfaceMount}), which the package does not export. Public useTooltip calls it with no internal options, so TooltipOptions is unchanged. CheckboxInput imports the internal entry.

* fix(CheckboxInput): name the reason with an id the checkbox owns; no Tooltip change

The tooltip's text is a span with the id the input's aria-describedby names. While the server renders and the client hydrates, the tooltip layer has no markup, so a visually hidden copy carries that id instead (useIsHydrating). useTooltip is back to main: no internal entry and no surface callback.

* Merge main into #11916's branch

* Merge #12376's branch (8ef2015)

# Conflicts:
#	packages/core/src/CheckboxInput/CheckboxInput.test.tsx
#	packages/core/src/CheckboxInput/CheckboxInput.tsx

* Tooltip: describe the trigger with an in-place hidden copy of its text

The trigger's aria-describedby names a hidden copy (the hidden attribute)
of the tooltip text, rendered next to the trigger in server and client
markup. The post-hydration portal copy and its mount store are gone; the
id never changes. The shown tooltip's content is hidden from assistive
technology (except while pinned), so the text is read once.

Truncation tooltips (UndescribedTooltip) and a Button tooltip that repeats
the name render no copy, through TooltipDescribesContext in
Tooltip/tooltipPresentInterest. Group trailing-radius rules skip hidden
elements. InfoTip and Slider find the tooltip through a private helper.

* test(Layer): a disabled reason may describe its control from inside the tooltip

CheckboxInput names its own reason text, which sits inside the tooltip
after the first show. The touch-target helper now accepts an
aria-describedby id that resolves inside the reason's tooltip.

* Merge #12376's branch (9ae1d5c)

* test(Tooltip): browser evidence for AR1 in Chromium and WebKit

A story with a wrapped Button, an icon tooltip that adds to the name, one
that repeats it, and a cut label. The spec checks the hidden copy and the
accessible description before and after the first show, once, and no
description on the repeat and cut-label paths. AR1 gets a verification row.

* Tooltip: component content reaches the description; FR10, AR1 and FR2 as ruled

- Content that holds a component renders into the hidden copy through a
  portal, filled on the client, so its text reaches the description and a
  block never breaks a paragraph in server markup.
- The shown content is aria-hidden on every path except a pinned tooltip.
- CheckboxInput's own reason is a hidden span.
- ButtonGroup and InputGroup skip only the tooltip copy, not every hidden
  follower.
- FR10 drops aria-controls from the pinning button; AR1 names the pinned
  exception; FR2 records the element-child and component-content
  server-markup gap. The changeset and content JSDoc say content renders
  once from mount.
- The browser spec finds the cut label's tooltip by text.

* Tooltip: the copy joins text through getNodeText; docs name the hydration group

- Host markup becomes the copy's text through the shared getNodeText, which
  joins block lines with a space; textOf is gone.
- The Chromium binding's coverage check skips the row for a trigger
  described by the tooltip itself, which no Astryx state meets.
- The changeset names the components whose tooltips name the copy only
  after hydration.
- The CustomToggleTrigger story drops aria-controls, as FR10 does.
- ButtonGroup.doc.mjs leaves the diff (formatting only).

* Merge main into lane4/tooltip-mount-on-first-intent

# Conflicts:
#	packages/core/src/CheckboxInput/CheckboxInput.test.tsx
#	packages/core/src/CheckboxInput/CheckboxInput.tsx
#	packages/core/src/Layer/touchTriggerTargets.test.tsx

* Merge remote-tracking branch 'origin/main' into lane4/tooltip-mount-on-first-intent

# Conflicts:
#	docs/specs/components/Tooltip/Tooltip.spec.md

* test(Tooltip): read the shown surface and the description copy as the first-show mount draws them

* fix(Tooltip): the trigger's description is the hidden copy only until the layer mounts, then the tooltip's content

* test(Tooltip): the trigger reads its description from the tooltip's content once it mounts

* docs(Tooltip): describedBy names the copy until the first show, then the content; AR6 drops aria-controls as FR10 does

* fix(Tooltip): the description's host reaches render through a store, not state; CheckboxInput drops a fragment

* refactor(Tooltip): description id helpers live with the trigger contracts, so a Button swizzle carries no tooltip runtime

* fix(Button): a caller's mounted tooltip content counts as its tooltip; the description host uses the shared store factory

* Merge main into lane4/tooltip-mount-on-first-intent

Resolves Button.tsx and useTooltip.tsx against #12443 and #11831's line: the cut label's tooltip comes from main's lazy cutText module, and its caller-tooltip check (now in cutText.tsx) also counts a description's hidden copy and mounted tooltip content. useTooltip keeps lazyMount, keepsMountAfterShow and main's getInvoker. SideNav's labelTooltipOf finds the tooltip through the trigger's description.

* test(Text, TextInput): main's new tooltip cases read the tooltip a first interaction mounts

* test(Selector, MultiSelector, Tooltip): RTL status tooltips read the shown tooltip; the coverage check skips the tooltip-described row only while every state describes with a copy

* test(cli): overlays come before progress-bar-track in the unreached list, a part main's themes still leave there

* test: TooltipDescription joins the Firefox hover specs; the Tooltip binding audit stays Chromium-only (DevTools protocol); prettier

* Merge remote-tracking branch 'origin/main' into lane4/tooltip-mount-on-first-intent

# Conflicts:
#	packages/core/src/Text/Text.test.tsx
#	packages/core/src/Tooltip/Tooltip.tsx

* test(Text): the truncation tooltip's mount reads its layer marker, since it adds no description (#12653) and its layer mounts at the first show

* docs(useTooltip): the hook's JSDoc sits on the hook again, not on TooltipDescription

* fix(ButtonGroup, InputGroup): the trailing edge skips a tooltip's description by its own private marker, so a caller's hidden element whose id ends in -description still counts as a member

* test: checks that read a closed tooltip's layer read its first show or its description inside it; the corner tests compile the trailing-edge owner too

* fix(Button): a cut label described by the caller's own -description element still shows on keyboard focus; tests hover named controls and count the new corner cases

* Merge remote-tracking branch 'origin/main' into lane4/tooltip-mount-on-first-intent

# Conflicts:
#	docs/specs/components/Tooltip/Tooltip.spec.md
#	packages/core/src/CheckboxInput/CheckboxInput.test.tsx
#	packages/core/src/CheckboxList/CheckboxList.test.tsx
#	packages/core/src/PowerSearch/PowerSearch.test.tsx
#	packages/core/src/RadioList/RadioList.test.tsx
#	packages/core/src/SegmentedControl/SegmentedControl.test.tsx
#	packages/core/src/Slider/Slider.test.tsx
#	packages/core/src/Switch/Switch.test.tsx
#	packages/core/src/Tokenizer/Tokenizer.test.tsx
#	packages/core/src/Tooltip/useTooltip.tsx

* test(Tooltip): hover tests send the move a browser sends with the arrival (#11831), and read the mount marker before a show

* test(Timestamp, RichTextEditor): hover tests send the move that follows the arrival

* test(Tooltip): the hidden copy reads inline markup as it renders

* Merge remote-tracking branch 'origin/main' into lane4/tooltip-mount-on-first-intent

* chore: comment-provenance baseline drops the Button and InputGroup citations this PR removed

* Merge remote-tracking branch 'origin/main' into lane4/tooltip-mount-on-first-intent

This branch was successfully deployed

1 active deployment
Preview — 45ab9ca1 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:1 Astryx fix-loop lane 1 owns this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant