Skip to content

feat(Table): window tables that use selection and row index - #10658

Merged
humbertovirtudes merged 1 commit into
mainfrom
table-virt/6-supported-plugins
Nov 8, 2026
Merged

humbertovirtudes merged 1 commit into
mainfrom
table-virt/6-supported-plugins

Conversation

@humbertovirtudes

@humbertovirtudes humbertovirtudes commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Stack

Row virtualization is split into eight stacked PRs, each under the 2,000-line limit. Each PR's base is the one above it, so review and merge from the top of this list down.

  1. perf(Table): build the row-index column once per plugin #10654 perf(Table): build the row-index column once per plugin
  2. refactor(core): share per-instance warning dedupe and temporary focus targets #10655 refactor(core): share per-instance warning dedupe and temporary focus targets
  3. feat(core): add the shared list-windowing module and Table's capability hook #10656 feat(core): add the shared list-windowing module and Table's capability hook
  4. feat(Table): add the window controller and Table's shared-geometry runtime #10657 feat(Table): add the window controller and Table's shared-geometry runtime
  5. feat(Table): window fixed-height flat tables through useTableRowsVirtualization #8280 feat(Table): window fixed-height flat tables through useTableRowsVirtualization
  6. feat(Table): window tables that use selection and row index #10658 feat(Table): window tables that use selection and row index (this PR)
  7. perf(Text): take a new text's first truncation measurement from the shared observer #10668 perf(Text): take a new text's first truncation measurement from the shared observer
  8. test(Table): add Chromium accessibility and 1k/10k/100k release evidence for row windowing #10659 test(Table): add Chromium accessibility and 1k/10k/100k release evidence for row windowing

Two record amendments the stack relies on: #10665 (Table adopts the shared list-windowing module first) and #10666 (a windowed row-number column fits its last position).

User need

Large tables usually also use selection and row numbers. Without this PR, a windowed table that uses either falls back to full rendering. Context-menu tables already stay windowed on the base; this PR adds tests that pin that.

Problem and solution fit

Each plugin that changes how a row renders now tells Table how it composes with fixed-height windowing, instead of Table guessing:

  • Selection and row-index columns register as fixed-height, so tables that use them stay windowed. The row index renders windowed numbers from Table's logical position, so an append needs no second key lookup.
  • A windowed row-number column fits its last position (docs(specs): windowed Table row-number columns fit their last logical position #10666). The window controller measures that width from the cell's computed font, padding and borders with canvas text metrics: no layout read and no DOM write. It measures in its first layout pass and again after a row-count or layout change, never on a scroll or a content change. Table applies the width to the header, since fixed layout sizes columns from it, so rows keep their columns. Ordinary tables keep the 48px column.
  • Pinned columns after a row-number column add its extra width: their sticky offsets read a table variable that Table sets to the widened width minus the floor.
  • Selection, sticky columns and tree data skip row-context tracking, which they never read.
  • Tree, grouped-row and row-expansion plugins declare their row models, so plugins that read the render context see the declared model. The fallback diagnostic is unchanged.
  • A [feat] Changeset (table-windowing-selection-row-index) names @astryxdesign/core.

Current specification

Public delta and caller burden

No new API. A windowed table that uses selection or row numbers now stays windowed. Callers do nothing new.

Design and alternatives

Plugins register through the existing private column-admission and row-context protocols. A public "fixed height" assertion prop on columns was rejected: it would let callers admit content that Table cannot verify. A row-number width computed from the digit count and a fixed padding was rejected: padding and the code font come from theme tokens and density, so it clipped at spacious density. A hidden DOM probe was rejected: it wrote to the DOM and forced layout on every layout invalidation.

Evidence

  • Row-index tests: windowed numbers come from Table positions after a same-array append without a second key lookup; a clipped number falls back without changing legacy widths.
  • The Chromium accessibility spec at the top of the stack scrolls a 2,000-row selection, row-index and sticky-column table to row 1,501 at compact, balanced and spacious density: the number fits its cell, the pinned ID column starts where the columns before it end, at most 15 rows are mounted, and no fallback is reported.
  • Controller tests: the row-number width comes from canvas text metrics with no rectangle read and no DOM write, and only a layout change measures again; after a width change at mount, the next pass still checks the body extent, so an extent the browser cannot hold falls back.
  • tableColumnAdmission tests: the same columns when no width is measured or every width fits, and a widened column otherwise.
  • A sticky-columns test: a column pinned after the row-number column offsets by calc(48px + var(--_table-logical-extra-0, 0px)), and an unwindowed table sets no variable.
  • Menu tests pin that context-menu tables stay windowed, keep an open menu's row and return focus to its trigger on close. They pass on the base too; no menu code changes here.
  • The release spec scrolls the selection, row-index and sticky-column table past row 1,000 at 1k/10k/100k rows and checks that it stays windowed.

Scope

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

  • Format (Prettier), strict lint (--max-warnings=0) on every changed file, and pnpm typecheck in packages/core pass on this exact head.
  • vitest run --project ui packages/core at the top of this stack: 20,720 tests pass. The Table, hooks, utils and Chat suites pass on this PR's own head. Four locale time-format tests (DateTimeInput, TimeInput, timeFormat) fail on the local machine's ICU data and pass in CI; they do not touch Table.
  • node scripts/pre-review.mjs --base <the branch below>: 920 authored lines.
  • CI runs on this PR once it targets main, that is, after the PRs below it merge.

This PR was generated with AI assistance (Navi).

@vercel

vercel Bot commented Nov 8, 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 8, 2026 8:26pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

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

@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: selection and row-index windowing works in balanced density, but three issues need fixing first.

  • The windowed # column width now depends on the row count and on whether the table is windowed (useTableRowIndex.tsx:120-127, asserted by the new 56px/48px test), which component:Table FR13, PR3 and DEC-2 rule out ("virtualization … cannot change any floor"), so keep one width that depends on neither or have an engineering owner amend FR13/DEC-2 for row-number columns first.
  • With density="spacious", a windowed table with row numbers falls back to full rendering when the reader scrolls into four-digit rows and the view jumps back to row 1, because getWindowedIndexWidth assumes the balanced 24px cell padding (useTableRowIndex.tsx:49-57).
  • The title, body and commit message say sticky-column and context-menu tables fell back and that the count-independence marks stop re-renders, but on the base both kinds of table already stay windowed, appending already re-renders only the new row, and the four TableMenuWindowFocus tests pass without this change, so retitle to selection and row index and either add a menu test that fails on the base or narrow that claim.

Two comment rewrites are suggested inline; they are not blocking.

[Automated review]

@humbertovirtudes
humbertovirtudes force-pushed the feat/table-virtualization-v1 branch from 3814d1b to a69b76a Compare November 8, 2026 09:55
@humbertovirtudes
humbertovirtudes force-pushed the table-virt/6-supported-plugins branch from a9cf951 to a511885 Compare November 8, 2026 09:55
@humbertovirtudes humbertovirtudes changed the title feat(Table): window tables that use selection, row index, sticky columns and menus feat(Table): window tables that use selection and row index Nov 8, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested: tables that use selection and row numbers now stay windowed, and spacious tables no longer fall back mid-scroll, but two issues remain.

  • The windowed # column is now widened from a measurement of the last row number (48 px unwindowed, 54 px windowed in balanced density and 62 px in spacious at 2,000 rows), which component:Table FR13, PR3 and DEC-2 rule out ("virtualization … cannot change any floor", resolution "without DOM measurement"), so keep one width that depends on neither windowing nor the row count, or have an engineering owner amend FR13, PR3 and DEC-2 for row-number columns first.
  • The title and body still say sticky-column and context-menu tables fell back and that the count-independence marks stop re-renders, and they cite a 56 px test that is no longer in this pull request, but on the base sticky-column and menu tables already stay windowed and re-render counts are unchanged, so retitle to "window tables that use selection and row index" and update the body to match the commit message.

[Automated review]

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approval waits on an engineering owner's spec decision, and two description fixes are needed.

  • Spec decision: the windowed # column is widened to fit its last number (48px unwindowed, 54px windowed in balanced and 62px in spacious density at 2,000 rows), which component:Table FR13, PR3 and DEC-2 rule out today ("virtualization … do not change any floor", floors resolve "without DOM measurement"), so this pull request depends on the exception proposed in #10666, and an engineering owner needs to decide that amendment, approving it by commenting /approve-spec <full head SHA> on #10666 (the author may do so as an engineering owner).
  • The body and commit message say the tests pin that sticky-column tables stay windowed, but the only fixture in TableMenuWindowFocus.test.tsx uses a custom menu plugin and no sticky columns, so add a useTableStickyColumns case or say the tests pin context-menu tables.
  • The body and commit message say that declaring the tree, grouped-row and expansion row models makes the full-render fallback say why, but the warning is the same string as before ("structural body modifiers must declare rowModel: 'flat' to admit windowing"), so describe what actually changes (plugins reading the render context see the declared model) or drop that clause.

Selection and row-index windowing otherwise works as described, and the new row-index tests cover it.

[Automated review]

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approval waits on an engineering owner's spec decision, and one description fix is needed.

  • Spec decision: in a windowed table the # column is widened to fit its last number (48px unwindowed, 55px windowed in balanced and 63px in spacious density at 2,000 rows), which component:Table FR13, PR3 and DEC-2 rule out today ("virtualization … do not change any floor", floors resolve "without DOM measurement … extra render passes, or dependence on row values"), so this pull request depends on the exception proposed in #10666, and an engineering owner needs to decide that amendment by commenting /approve-spec <full head SHA> on #10666 (the author may do so as an engineering owner).
  • The body says "Sticky-column and context-menu tables already stay windowed on the base; this PR adds tests that pin that", but no test here windows a sticky-column table (the only windowed fixture in TableMenuWindowFocus.test.tsx has no sticky columns, and the new sticky test renders without virtualization), so say the tests pin context-menu tables or add a windowed useTableStickyColumns case.

Selection and row-index windowing otherwise works as described, and the pinned columns now start where the widened # column ends. Two small comment suggestions are inline.

[Automated review]

Comment on lines +708 to +709
// Fixed layout sizes columns from the header, so rows keep their columns;
// pinned offsets read the extra width from a table variable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking (INV29): this sentence packs two topics. Suggested: "Fixed layout sizes columns from the header. Pinned offsets read the extra width from a table variable."

}
const spacing =
style.letterSpacing === 'normal' ? 0 : readPixels(style.letterSpacing);
// Padding and borders between the text and the column edge.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking (INV29): the comment restates the loop below it. Renaming chrome to paddingAndBorders says the same thing, and the comment can go.

@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 description fix remains; the spec question is settled.

  • The body says "Sticky-column and context-menu tables already stay windowed on the base; this PR adds tests that pin that", but no test here windows a sticky-column table (the only windowed fixture in TableMenuWindowFocus.test.tsx has no sticky columns, and the new sticky test renders without virtualization), so say the tests pin context-menu tables or add a windowed useTableStickyColumns case.

The windowed # width now follows component:Table FR13, PR3 and DEC-2 as amended by #10666, and in Chromium it re-measured on a 999-to-1,000 append, a density switch and a host-inset change without clipping or falling back. The two earlier non-blocking comment suggestions stay open inline.

[Automated review]

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not run on this head yet, and it runs once this pull request targets main.

The description now matches the tests, which pin context-menu tables only; that was the last blocking item. The windowed # width follows component:Table FR13, PR3 and DEC-2 as amended by #10666: in Chromium, a 2,000-row table with selection, row numbers and a pinned column stays windowed at row 1,500 with the # column at 54px (balanced) and 62px (spacious), and appending row 1,000 widens it from 48px to 54px without falling back. Two non-blocking comment suggestions stay open inline.

[Automated review]

@humbertovirtudes
humbertovirtudes force-pushed the feat/table-virtualization-v1 branch 2 times, most recently from bf45941 to fa70042 Compare November 8, 2026 19:53
Selection and row-index columns register as fixed-height, so tables
that use them stay windowed. The row index renders windowed numbers
from the Table logical position. A windowed table widens a row-number
column to fit its last position: the controller measures it from the
cell's computed font and padding with canvas text metrics, in its first
layout pass and after row-count or layout changes, and Table applies
it to the header, so rows keep their columns. Pinned columns after a
row-number column add its extra width through a table variable.
Selection, sticky columns and tree data skip row-context tracking,
which they never read; tree, grouped-row and row-expansion plugins
declare their row models, which plugins reading the render context see.

This diff was generated with AI assistance (Navi).
Tags: ai-generated
@humbertovirtudes
humbertovirtudes changed the base branch from feat/table-virtualization-v1 to main November 8, 2026 20:18
@humbertovirtudes
humbertovirtudes force-pushed the table-virt/6-supported-plugins branch from 56046e1 to 6ea613c Compare November 8, 2026 20:18

@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 is still running on this head.

Tables that use selection or row numbers now stay windowed, and the windowed # column widens to fit its last number under the component:Table FR13 exception that #10666 added. In Chromium, a 2,000-row table with checkboxes, row numbers and a pinned column mounts 16 to 21 rows at row 1,500, every number fits, and the pinned column stays flush with the columns before it; the Table tests, typecheck, lint and the Changeset check pass.

Two optional comment tweaks remain open in BaseTable.tsx and useTableWindow.ts.

[Automated review]

@humbertovirtudes
humbertovirtudes merged commit 90ebe00 into main Nov 8, 2026
75 checks passed
@github-actions
github-actions Bot deleted the table-virt/6-supported-plugins branch November 9, 2026 06:03

This branch was successfully deployed

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

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant