Repository navigation
Conversation
Pins a table's header row to the top of its scroll container so column headings stay readable while the body scrolls. Pass `maxHeight` to give the table a scrollport of its own, or omit it when an ancestor already bounds the height. Composes with `useTableStickyColumns` in either install order: the corner cell where a pinned column crosses the pinned header stays above both runs. Header cells are transparent by default, so the plugin gives them the same opaque `--table-sticky-background` the pinned column already uses, letting one override cover both. Co-authored-by: Cursor <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
`generate-data.mjs` compares generated ShadCN routes against a reviewed lock, so a new hook doc fails the docsite check until its route is recorded. Refreshed with UPDATE_SHADCN_ROUTE_LOCK=1; the only entry added is the plugin's own. Co-authored-by: Cursor <[email protected]>
`Table`'s `plugins` prop takes `Record<string, TablePlugin<T>>`. The tests passed arrays, which run fine — an array is an object with numeric keys, so the plugin pipeline reads it — but `tsc` rejects the missing string index signature. Vitest was green and `typecheck` was not. Co-authored-by: Cursor <[email protected]>
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: 35 accessibility violation(s) found — 2 critical, 33 serious. Button pattern - 1 issue(s)
ChatComposer - 1 issue(s)
ChatComposerInput - 1 issue(s)
ChatReasoning - 1 issue(s)
ChatToolCalls - 1 issue(s)
Checkbox pattern - 1 issue(s)
CheckboxList - 1 issue(s)
ClickableCard - 1 issue(s)
CodeEditor - 1 issue(s)
CodeEditorPerf - 1 issue(s)
CodeEditorTheme - 1 issue(s)
CodeTheme - 1 issue(s)
DateRangeInput - 1 issue(s)
FileInput - 1 issue(s)
GridMasonry - 1 issue(s)
Heading - 1 issue(s)
Icon - 1 issue(s)
LogStream - 1 issue(s)
MediaTheme Auto - 1 issue(s)
PowerSearch - 1 issue(s)
ProgressBar - 1 issue(s)
Radio group pattern - 1 issue(s)
RadioList - 1 issue(s)
RichTextEditor - 2 issue(s)
SelectableCard - 1 issue(s)
Stepper - 1 issue(s)
TableTree - 1 issue(s)
Text - 1 issue(s)
Theme - 1 issue(s)
PopArt - 1 issue(s)
Thumbnail - 1 issue(s)
Timestamp - 1 issue(s)
Token - 1 issue(s)
Tokenizer - 1 issue(s)
Visual RegressionStatus: No visual change across 2 compared shot(s). Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
The hook shipped without any example block, so its docs page had nothing
to render — public hooks are expected to ship them, and the docsite's
hook-page test only covers hooks that do.
Two blocks, one per behaviour the hook's description calls out:
- Pinned Header — maxHeight caps the scroll container so the table owns a
scrollport for the header to pin inside. Fourteen rows against a 320px
cap, so it actually scrolls.
- With Pinned Columns — composed with useTableStickyColumns. Fixed column
widths overflow a 560px container so it scrolls both ways, showing the
corner cell staying above both runs.
Also corrects the hook's JSDoc example from plugins={[stickyHeader]} to
plugins={{stickyHeader}}. Table takes Record<string, TablePlugin<T>>, and
this was the only array form left in the plugins directory.
Co-authored-by: Cursor <[email protected]>
|
Changeset coverage — the cli package isn't named This branch adds four consumer-visible files to
The only changeset, Precedent: #5567 changed only block templates under Either shape works:
Both packages are pre-1.0, so Nothing else in the diff needs an entry: |
humbertovirtudes
left a comment
There was a problem hiding this comment.
Requesting changes based on exact-head review and a synthetic merge with current main. The primary feature fails after the current Table scroll-owner integration, plugin order changes corner paint and hit-testing, and the committed tests do not observe those behaviours. I also found authority, registry-policy, and children-mode gaps inline.
Validation: exact-head CI has 28 successful checks and 1 skipped check. The focused suite passes 7/7, but destructive CSS mutations also pass 7/7. Chromium reproduces both the corner overpaint and the current-main wheel-scroll failure.
| // gives its own header cells: where a pinned column crosses the pinned | ||
| // header, that corner has to win on both axes, and letting the higher value | ||
| // stand is what keeps it there. | ||
| zIndex: 2, |
There was a problem hiding this comment.
Blocking: the corner tier is last-wins, not max-wins. Chromium with both axes scrolled produced corner z-index: 3 and correct hit-testing for {stickyHeader, stickyColumns}, but z-index: 2 and the scrolled Reading header overpainting the pinned Sensor corner for {stickyColumns, stickyHeader}. Please make this stacking relationship order-independent and cover both orders with browser paint and hit-testing assertions. The same composition surface should also be checked with columnResize, which can append position: relative after this rule.
There was a problem hiding this comment.
Fixed the order-dependent stacking in e049b36: sticky position and the 3/2/1 corner-header-body tiers are now composition-authoritative in either plugin order, including when column resize runs last. Added focused coverage for both orders and resize composition. The separate shared block-scroll-owner and Chromium paint/hit-testing work remains open, so I am leaving this thread unresolved.
| ...props.htmlProps, | ||
| style: {...props.htmlProps.style, ...heightStyle}, | ||
| }, | ||
| xstyle: [...props.xstyle, stickyHeaderStyles.scrollWrapper], |
There was a problem hiding this comment.
Blocking: this does not survive current main's Table scroll-owner integration. In a clean synthetic merge with current main a3f81843b26bfadc27d486b13602598f11745461, useScrollableArea({axis: 'inline'}) applies its owned overflow styles after this plugin and the wrapper computes overflow-y: hidden. Chromium measured clientHeight: 320, scrollHeight: 1557; a wheel event left scrollTop at 0, so rows are clipped and the sticky header cannot perform its primary function. Please integrate block scrolling through Table's shared scroll owner and add a current-main browser regression.
There was a problem hiding this comment.
Blocking: the shared scroll-owner failure remains on the current head. In a clean synthetic merge with main 9f0783f1272676e998c5340c849644b6858f9e49, Chromium computes overflow-y: hidden on this wrapper (clientHeight: 320, scrollHeight: 1557), and wheel input leaves scrollTop at 0. Programmatic assignment can move the hidden scroll position, but users cannot scroll it. Please integrate block scrolling through Table's shared logical-axis useScrollableArea owner and add a current-main Chromium regression that drives wheel input.
|
|
||
| // The corner cell keeps the column plugin's inline offset, so both | ||
| // plugins reached it rather than one replacing the other's work. | ||
| expect(headerCells()[0].style.insetInlineStart).toBe('0px'); |
There was a problem hiding this comment.
Blocking: this test cannot fail for the behaviour in its title. It checks the sticky-column inline offset and maxHeight, but neither assertion observes header position or corner stacking. All 7 tests remained green after changing position: sticky to static, insetBlockStart to 47, and zIndex to 99; independent mutations removing position, background, z-index, and wrapper styling also survived. Please move the rendered behaviour to the existing Chromium lane and assert vertical scrolling, sticky geometry, opaque paint, both plugin orders, and corner hit-testing.
There was a problem hiding this comment.
e049b36 replaces the false-confidence composition assertion with checks that fail if sticky positioning, either axis, the 3/2/1 stacking tiers, or resize composition regresses. Real Chromium scroll geometry, paint, and hit-testing still depend on the separate shared block-scroll-owner decision, so this thread remains unresolved.
| export {useTableColumnSettingsState} from './plugins/columnSettings'; | ||
| export {useTableColumnResize} from './plugins/columnResize'; | ||
| export {useTableStickyColumns} from './plugins/stickyColumns'; | ||
| export {useTableStickyHeader} from './plugins/stickyHeader'; |
There was a problem hiding this comment.
Blocking: this exports a new stable Table module without a current canonical owner. Table.spec.md lists only module:Table/useTableRowStatus and explicitly leaves independently contractible module APIs outside the aggregate contract. Please add an approved module:Table/useTableStickyHeader record, link it from Table.spec.md, and define the behaviour, compatibility, theming, accessibility, isolation, and evidence contract before exporting the hook. This should also explicitly govern the widened --table-sticky-background meaning.
There was a problem hiding this comment.
Blocking: the authority and stacking-owner finding remains open. Table.spec.md is unchanged, lists only module:Table/useTableRowStatus, and still excludes new runtime behavior and public API. The respin also publishes --table-sticky-header-height, widens --table-sticky-background, and Chromium reports isolation: auto on the scroll wrapper despite the new 3/2/1 local tiers. Please add an approved sticky-header module record with the Table backlink, govern both variables, and isolate the complete Table stacking surface before exporting this hook.
| if ( | ||
| dependencyTag == null && | ||
| block.exampleFor != null && | ||
| !availablePublicEntryNames.has(block.exampleFor) |
There was a problem hiding this comment.
Major: this silently changes production policy for every owned registry block, but the only registry system spec, AST-026, is still draft and this policy is unrelated to the Table feature. There is also a concrete target mismatch: generateShadcnRegistryForTarget() validates and discards target, while this branch uses independently supplied dependencyTag. Direct reproduction shows latest + canary publishes unreleased blocks and canary + null omits them. Please split and govern this policy, derive publication mode from target or reject inconsistent inputs, and test through generateShadcnRegistryForTarget().
There was a problem hiding this comment.
Major: this unrelated production-registry policy remains unchanged and the target mismatch still reproduces. generateShadcnRegistryForTarget() validates but discards target; latest + dependencyTag: 'canary' publishes an unavailable owned block, while canary + dependencyTag: null omits it. Please split this policy into its own governed PR, then derive publication mode from target or reject inconsistent inputs and test through generateShadcnRegistryForTarget().
There was a problem hiding this comment.
Major: the children-mode mismatch remains. This still describes a generic Table plugin, but BaseTable applies transformHeaderCell only to generated data-driven headers and passes caller-composed children through unchanged. The wrapper receives the height cap while a caller-composed TableHeaderCell remains non-sticky. Please document the hook as data-driven-only, matching the current Table contract, or add a supported children-mode integration seam with a regression test.
There was a problem hiding this comment.
Blocking scope expansion: this respin adds a separate public grouping behavior, sticky paint, a new changeset, and cross-plugin coupling through --table-sticky-header-height. The current Table owner explicitly excludes grouping anatomy and new runtime/API/styling, and the new tier also joins the still-unisolated Table stack. Please split hasStickyGroupHeaders into its own authority-first PR. The disclosure ARIA repair is restorative but separable and should also land independently.
| subComponentOf: 'Table', | ||
| displayName: 'useTableStickyHeader', | ||
| description: | ||
| "Hook that returns a TablePlugin which pins the header row to the top of the table's scroll container, so column headings stay readable while the body scrolls. The header pins to a scrollport the table owns, so pass maxHeight unless an ancestor already bounds the table's height. Composes with useTableStickyColumns: install both to pin a column and the header at once, and the corner where they cross stays above both.", |
There was a problem hiding this comment.
Major: this reads as a generic Table plugin, but children mode receives only the scroll-wrapper transform. BaseTable applies transformHeaderCell solely to generated data-driven headers, then passes caller-composed children through unchanged. A focused probe confirmed the wrapper receives maxHeight: 120px while a caller-composed TableHeaderCell remains non-sticky. Please either document this as data-driven-only, matching the current Table contract, or add a supported children-mode integration seam and test it.
* feat(Table): pin group headings while their section is on screen useTableGroupedRows takes hasStickyGroupHeaders. With it on, each heading holds at the top of the table's scroll container until the next section pushes it out, so a reader scrolling deep inside a long group can still see which group they are in. A sticky cell leaves its row behind, and the row is what carries the heading's fill, so the pinned cell needs a background of its own or the rows travelling under it show through. It also sits at z-index 2 to clear the body cells useTableStickyColumns pins at 1, which would otherwise paint over the heading as rows pass beneath. The offset needed the two plugins to cooperate. A heading pinned at the top of the scrollport lands on the header row useTableStickyHeader pins there too, and because tbody follows thead in the document the heading wins and hides it. useTableStickyHeader now measures its header and publishes the height as --table-sticky-header-height on the scroll container, and a pinned heading starts below that — the same way the two plugins already share --table-sticky-background. With no pinned header the variable is unset and the heading pins to the top edge, which is right for a table that only pins its headings. Co-authored-by: Cursor <[email protected]> * fix(Table): use the documented `default` key in the grouped-rows doc HookParamDoc spells it `default`, not `defaultValue`. The docsite compiles its generated registry against that type, so the wrong key only surfaced as a Next.js type error in the Vercel build rather than anywhere local. Co-authored-by: Cursor <[email protected]> * fix(Table): publish the logical block-axis extent for sticky header height Per AST-025 FR1/FR3, resolve the logical block axis through the computed writing mode before reading physical geometry. In vertical and sideways writing modes the block axis is horizontal, so the published --table-sticky-header-height is the thead's width there; the physical height clipped pinned headings and the collapse control. * fix(Table): read writing mode from computed styles * fix(Table): clear sticky header height on detach --------- Co-authored-by: Cursor <[email protected]> Co-authored-by: ernestt <[email protected]>
humbertovirtudes
left a comment
There was a problem hiding this comment.
Re-reviewed exact head e049b365be4c54a4bc98f01f80109207ae684a6a. The order-dependent corner stacking is fixed in both plugin orders, including with column resize. Requesting changes because the shared scroll-owner failure, test gap, authority and isolation gap, registry policy mismatch, and children-mode mismatch remain. The respin also adds an independently contractible grouped-header API that needs to be split or governed.
Evidence: focused tests pass 29/29, typecheck, lint, knowledge validation, and the clean synthetic merge with main 9f0783f1272676e998c5340c849644b6858f9e49 pass. Chromium still computes overflow-y: hidden on a 320px wrapper with 1557px of content, and wheel input leaves scrollTop at 0.
| ...props.htmlProps, | ||
| style: {...props.htmlProps.style, ...heightStyle}, | ||
| }, | ||
| xstyle: [...props.xstyle, stickyHeaderStyles.scrollWrapper], |
There was a problem hiding this comment.
Blocking: the shared scroll-owner failure remains on the current head. In a clean synthetic merge with main 9f0783f1272676e998c5340c849644b6858f9e49, Chromium computes overflow-y: hidden on this wrapper (clientHeight: 320, scrollHeight: 1557), and wheel input leaves scrollTop at 0. Programmatic assignment can move the hidden scroll position, but users cannot scroll it. Please integrate block scrolling through Table's shared logical-axis useScrollableArea owner and add a current-main Chromium regression that drives wheel input.
| expect(pinned.length).toBeGreaterThan(bare.length); | ||
| }); | ||
|
|
||
| it('keeps sticky positioning and corner tiers in either plugin order, even with resize last', () => { |
There was a problem hiding this comment.
Major: this is a useful improvement and now protects the 3/2/1 tiers and resize composition, but the observable scroll and paint paths are still unguarded. Removing the sticky-header background and dropping stickyHeaderStyles.scrollWrapper leaves all 12/12 tests green. Please add committed Chromium coverage for wheel scrolling, sticky geometry, opaque background, both plugin orders, and corner hit-testing. The wheel assertion should fail on the current synthetic merge, where overflow-y computes to hidden.
| export {useTableColumnSettingsState} from './plugins/columnSettings'; | ||
| export {useTableColumnResize} from './plugins/columnResize'; | ||
| export {useTableStickyColumns} from './plugins/stickyColumns'; | ||
| export {useTableStickyHeader} from './plugins/stickyHeader'; |
There was a problem hiding this comment.
Blocking: the authority and stacking-owner finding remains open. Table.spec.md is unchanged, lists only module:Table/useTableRowStatus, and still excludes new runtime behavior and public API. The respin also publishes --table-sticky-header-height, widens --table-sticky-background, and Chromium reports isolation: auto on the scroll wrapper despite the new 3/2/1 local tiers. Please add an approved sticky-header module record with the Table backlink, govern both variables, and isolate the complete Table stacking surface before exporting this hook.
| if ( | ||
| dependencyTag == null && | ||
| block.exampleFor != null && | ||
| !availablePublicEntryNames.has(block.exampleFor) |
There was a problem hiding this comment.
Major: this unrelated production-registry policy remains unchanged and the target mismatch still reproduces. generateShadcnRegistryForTarget() validates but discards target; latest + dependencyTag: 'canary' publishes an unavailable owned block, while canary + dependencyTag: null omits it. Please split this policy into its own governed PR, then derive publication mode from target or reject inconsistent inputs and test through generateShadcnRegistryForTarget().
| if ( | ||
| dependencyTag == null && | ||
| block.exampleFor != null && | ||
| !availablePublicEntryNames.has(block.exampleFor) |
There was a problem hiding this comment.
Major: the children-mode mismatch remains. This still describes a generic Table plugin, but BaseTable applies transformHeaderCell only to generated data-driven headers and passes caller-composed children through unchanged. The wrapper receives the height cap while a caller-composed TableHeaderCell remains non-sticky. Please document the hook as data-driven-only, matching the current Table contract, or add a supported children-mode integration seam with a regression test.
| if ( | ||
| dependencyTag == null && | ||
| block.exampleFor != null && | ||
| !availablePublicEntryNames.has(block.exampleFor) |
There was a problem hiding this comment.
Blocking scope expansion: this respin adds a separate public grouping behavior, sticky paint, a new changeset, and cross-plugin coupling through --table-sticky-header-height. The current Table owner explicitly excludes grouping anatomy and new runtime/API/styling, and the new tier also joins the still-unisolated Table stack. Please split hasStickyGroupHeaders into its own authority-first PR. The disclosure ARIA repair is restorative but separable and should also land independently.
humbertovirtudes
left a comment
There was a problem hiding this comment.
Requesting changes because the public hook, scroll ownership, styling, measurement protocol, and projections conflict with current Table and AST-025 authority. A browser probe on current main computed overflow-y: hidden with 1,557px of content, and wheel input left scrollTop at zero. Please resolve the ownership and scroll semantics, then add a Table isolation boundary for header, grouped-header, and corner stacking tiers.
The plugin declared `position: sticky` and `overflow-y: auto` unconditionally, which made every table that installed it a permanent CSS scroll container. A table with nothing to scroll would then capture a header pinned by an outer scrollport — AST-025 FR10/FR21 and DEC-3 rule that out: sticky resolves against the nearest *effective* block owner, and scroll intent alone is not containment. The scroll wrapper now goes through `useScrollableArea`, which owns axis resolution, live measurement, and the overflow the wrapper declares — clip while fitting, the writing-mode-resolved auto/hidden pair once it overflows. The header pins only while the block axis measures effective; `hasPersistentContainment` is the explicit opt-in for keeping the boundary anyway. Table's `<table>` registers as the content box rather than the hook inventing a wrapper. The second ResizeObserver is gone: the header extent still needs its own measurement, but it rides the shared observer. `maxHeight` becomes `maxBlockSize`. The cap has to follow the axis the header travels on, which is horizontal in a vertical writing mode, and the file already resolved writing mode for the published extent. Two things follow from putting new ranks in that wrapper. The wrapper now isolates itself, so pinned columns, a pinned header, pinned group headings and the resize handle stay local instead of meeting page chrome. And the ranks come from one shared table: a group heading and the header row used to tie at 2, safe only while the extent variable was current, so they now hold separate tiers. Two supporting fixes in the plugin API. A scroll-wrapper plugin's `className` and `style` were being overwritten by the wrapper's own merge; they now survive it. And a plugin can set `hasPluginOwnedOverflow` to take the wrapper's overflow over entirely, so two sources never declare `overflow-x` on one element and leave CSS source order to settle it. Table suite: 564 tests, 27 files.
There was a problem hiding this comment.
Waiting on a maintainer spec decision before this can be approved.
The sticky-header implementation now follows the shared measured scroll behavior, uses a logical block-size cap, isolates the Table scroll wrapper, and keeps the corner tier in either plugin order — those parts align with the current scrolling and local-stacking specs in substance.
As the PR notes, approval needs a maintainer to provide or identify the governing spec for two additions the Table record does not yet carry: the scroll wrapper as an isolation owner, and a plugin taking over the wrapper's overflow (hasPluginOwnedOverflow). That decision should also admit the new hook module, including maxBlockSize/hasPersistentContainment, --table-sticky-header-height, and the widened --table-sticky-background — either by amending the Table spec or by recording that AST-025's Table adoption governs them.
Independent items to address or split once that is settled:
- Split the separable sticky group-headings change and the production registry filter; the registry entry point also discards its
targetwhile publication follows a separate tag. - Document the hook as data-driven-only or support caller-composed (children-mode) headers, which currently do not pin.
- Add real-browser coverage for wheel scrolling, the fitting-to-overflowing transition, sticky paint, and corner hit-testing — jsdom proves only the fitting half.
[Automated review]
humbertovirtudes
left a comment
There was a problem hiding this comment.
I reviewed the current head (1c3a51b) directly. The earlier plugin-order, sticky-column corner tier, resize composition, shared scroll-owner, and CLI changeset issues are fixed. Thank you for addressing those.
I am still requesting changes for these blockers:
-
Do not publish a header offset when the header is not pinned.
useTableStickyHeader.tsxpublishes--table-sticky-header-heightunconditionally inpublishHeaderExtent, butisPinnedis false for a fitting table under the defaultwhenScrollablecontainment.useTableGroupedRows.tsxthen always consumes that variable forhasStickyGroupHeaders. A focused composition probe with both plugins produced an unpinned column header (position === '') while the wrapper still published a44pxoffset. Under an outer effective scroll owner, the group heading can therefore stick with a false gap below a header that has scrolled away. Please publish/remove the extent in lockstep withisPinned, and add a combined-plugin regression covering the fitting outer-owner state and the transition to an overflowing/pinned table. -
Establish the public contract before exporting the hook.
Table/index.tsaddsuseTableStickyHeaderandUseTableStickyHeaderConfig, while the currentTable.spec.mdlists onlymodule:Table/useTableRowStatusand explicitly records unchanged runtime/API/styling plus no new runtime behavior or API. Please add an approved module owner for this public hook (and list it fromTable.spec.md) covering the API/defaults, compatibility, generated-header-only behavior in children mode, theming ownership, and required evidence—or keep the API private until that decision is current. -
Make registry publication policy depend on the validated target.
generateShadcnRegistryForTarget()validatestargetand then drops it; the new unpublished-block filtering instead depends on the independentdependencyTag. I reproduced the mismatch:target: 'latest'plusdependencyTag: 'canary'emitted an unavailable example, whiletarget: 'canary'plusdependencyTag: nullskipped it. Please derive the publication mode fromtarget(or reject inconsistent pairs) and test the exported target-aware wrapper, not onlybuildShadcnRegistry(). -
Add the browser evidence the implementation delegates to. The new unit suite explicitly leaves fitting→overflowing transitions, computed overflow/paint, sticky geometry, and hit testing to real-browser coverage, but this PR does not add a browser test. Please add committed browser coverage for the default fitting state under an outer scroll owner, the overflowing/pinned state, sticky-header + sticky-group-header composition, opaque paint, and the sticky-column corner interaction.
The current branch also conflicts with main in Table.tsx, generate-shadcn-registry.mjs, and its registry test. Please rebase and rerun the evidence after resolving those conflicts. Finally, re-check the one-primary-intent rule: the separate grouped-header public API and registry publication-policy changes should be split unless they are documented as necessary supporting deltas for this feature.
There was a problem hiding this comment.
Thanks for building this — keeping column headings visible while a long table scrolls is a real readability win, and the measured scroll-ownership approach, the wrapper isolation, and the corner layering all check out in a browser on this revision.
Requesting changes, mostly to match the maintainer direction already recorded on this PR:
- Move sizing to Table as
maxHeightand remove the sizing API from the plugin; any containment override belongs in Table's scroll configuration, not in the plugin's options. Update the docs, stories, template blocks, and changesets to match, and land the approved module record for the hook. - Split the grouped-heading, registry, and
aria-expandedchanges into their own PRs. - Do not publish
--table-sticky-header-heightwhile the header is not pinned: on a fitting table the grouped heading currently inherits a false offset below a header that has scrolled away. Publish or remove the extent in step with the pinned state, with a combined-plugin regression. - Make registry publication depend on the validated target: the target-aware entry point currently discards
target, solatestwith a canary tag andcanarywith no tag publish different blocks than their targets say. - Either document the plugin as data-driven-only or support children mode — today a caller-composed header does not pin even though its wrapper scrolls.
- Make sure scrolling does not repeatedly rerender Table (the plugin currently rebuilds when the measured scroll state changes, including edge transitions), and add committed browser coverage for the fitting-to-overflowing transition, the fitting grouped composition, opaque paint, and the corner interaction — jsdom proves only the fitting half.
- The branch also conflicts with current main in
Table.tsx, the registry generator, and its test; please rebase and re-check wheel scrolling and computed overflow afterwards.
[Automated review]
| getComputedStyle(head).writingMode, | ||
| ); | ||
| el.style.setProperty( | ||
| HEADER_EXTENT_VAR, |
There was a problem hiding this comment.
Do not publish the header extent when the header is not pinned. publishHeaderExtent writes --table-sticky-header-height unconditionally here (only detach removes it), but isPinned is false for a fitting table under the default whenScrollable containment, and useTableGroupedRows always consumes this variable for hasStickyGroupHeaders. The result: under an outer effective scroll owner, a group heading sticks with a false gap below a column header that has scrolled away — and the grouped-headings changeset's claim that "with no pinned header the variable is unset" does not hold once this plugin is installed. Please publish/remove the extent in lockstep with isPinned, and add a combined-plugin regression covering the fitting outer-owner state and the transition to an overflowing, pinned table.
| for (const block of blocks) { | ||
| if ( | ||
| dependencyTag == null && | ||
| block.exampleFor != null && |
There was a problem hiding this comment.
Registry publication policy must depend on the validated target. This filter keys on the independently supplied dependencyTag, while generateShadcnRegistryForTarget() validates its target argument and then discards it. The two diverge in practice: target: 'latest' with dependencyTag: 'canary' emits an unavailable owned block, while target: 'canary' with dependencyTag: null skips it. Please derive the publication mode from target (or reject inconsistent pairs) and test through generateShadcnRegistryForTarget(), not only through buildShadcnRegistry().
There was a problem hiding this comment.
Thanks for building this — keeping column headings visible while a long table scrolls is a real readability win, and the measured scroll-ownership approach, the wrapper isolation, and the corner layering all check out in a browser on this revision.
Requesting changes, mostly to match the maintainer direction already recorded on this PR:
- Move sizing to Table as
maxHeightand remove the sizing API from the plugin; any containment override belongs in Table's scroll configuration, not in the plugin's options. Update the docs, stories, template blocks, and changesets to match, and land the approved module record for the hook. - Split the grouped-heading, registry, and disclosure changes into their own PRs.
- Do not publish the header-height variable while the header is not pinned: on a fitting table the grouped heading currently inherits a false offset below a header that has scrolled away. Publish or remove the extent in step with the pinned state, with a combined-plugin regression.
- Make registry publication depend on the validated target: the target-aware entry point currently discards
target, solatestwith a canary tag andcanarywith no tag publish different blocks than their targets say. - Either document the plugin as data-driven-only or support children mode — today a caller-composed header does not pin even though its wrapper scrolls.
- Make sure scrolling does not repeatedly rerender Table (the plugin currently rebuilds when the measured scroll state changes, including edge transitions), and add committed browser coverage for the fitting-to-overflowing transition, the fitting grouped composition, opaque paint, and the corner interaction — jsdom proves only the fitting half.
- The branch also conflicts with current main in
Table.tsx, the sticky-columns plugin, the registry generator, and its test; please rebase and re-check wheel scrolling and computed overflow afterwards.
[Automated review]
| const blockIsHorizontal = /^(vertical|sideways)/.test( | ||
| getComputedStyle(head).writingMode, | ||
| ); | ||
| el.style.setProperty( |
There was a problem hiding this comment.
Do not publish the header extent when the header is not pinned. This callback writes --table-sticky-header-height unconditionally (only detach removes it), but isPinned is false for a fitting table under the default whenScrollable containment, and useTableGroupedRows always consumes this variable for hasStickyGroupHeaders. The result: under an outer effective scroll owner, a group heading sticks with a false gap below a column header that has scrolled away — and the grouped-headings changeset's claim that "with no pinned header the variable is unset" does not hold once this plugin is installed. Please publish/remove the extent in lockstep with isPinned, and add a combined-plugin regression covering the fitting outer-owner state and the transition to an overflowing, pinned table.
| let skippedUnpublishedBlocks = 0; | ||
| for (const block of blocks) { | ||
| if ( | ||
| dependencyTag == null && |
There was a problem hiding this comment.
Registry publication policy must depend on the validated target. This filter keys on the independently supplied dependencyTag, while generateShadcnRegistryForTarget() validates its target argument and then discards it. The two diverge in practice: target: 'latest' with dependencyTag: 'canary' emits an unavailable owned block, while target: 'canary' with dependencyTag: null skips it. Please derive the publication mode from target (or reject inconsistent pairs) and test through generateShadcnRegistryForTarget(), not only through buildShadcnRegistry().




Adds
useTableStickyHeader, which pins a table's header row to the top of its scroll container so column headings stay readable while the body scrolls.Why
useTableStickyColumnsalready pins columns horizontally, and the two problems are the same shape: a wide comparison table is unreadable once the labels leave the viewport. Vertically there was no answer — a long table scrolled its headings away and left the reader looking at anonymous columns of numbers.Both shots below scroll the same table by 400px. The only difference is whether the header is pinned.
In the "before" shot the five columns are still there, but nothing says which model each one is; the reader has to scroll back up and hold five names in their head. Pinned, the selectors stay put and the comparison reads straight down.
Using it
maxBlockSizegives the table a scrollport of its own. Omit it when an ancestor already bounds the table and it simply fills it.Worth knowing when you pick between those: a table that pins columns is already inside a wrapper with inline-axis overflow, and CSS promotes the other axis alongside it. That wrapper is therefore the sticky containing block, and a header inside it cannot pin to the page — so on a page-scrolled layout the plugin needs
maxBlockSizeto have anything to stick within.Pinning follows measured ownership
The plugin does not simply declare
position: sticky. It hands the scroll container touseScrollableArea— the shared behaviorspec:AST-025makes canonical — and pins the header only while that container measurably overflows on the block axis.That matters because of what the alternative costs. A table that fits, with an unconditional
overflow-y: auto, is still a CSS scroll container, and it becomes the sticky containing block for everything inside it. A header pinned by an outer scrollport would stop working the moment this plugin was installed on a short table.spec:AST-025FR10 resolves sticky against the nearest effective block owner, and FR21/DEC-3 keep a fitting viewport onclipso ownership passes outward.hasPersistentContainmentis the explicit opt-in for keeping the boundary anyway, matchingScrollableArea'sstickyContainment="always".Adopting the hook also means the wrapper's overflow is resolved per axis from live geometry rather than declared, the header's own tab stop and overscroll behavior come from one place, and there is no second
ResizeObserverbeside the shared one (FR5/IR1). Table's<table>registers as the content box, which FR6 allows precisely so a component that already owns suitable structure does not get a wrapper inserted into it.maxBlockSizerather thanmaxHeightfor the same reason the published extent already resolved writing mode: in a vertical writing mode the block axis is horizontal, and a cap on the wrong axis bounds nothing the header travels along.Composing with sticky columns
Install both in either order and the corner cell — where a pinned column crosses the pinned header — stays above both runs. Two of the tests cover exactly this, once per plugin order, since the transform pipeline applies them in sequence and the tier has to survive both.
Header cells are transparent by default, which is invisible until something scrolls underneath them. The plugin gives them the same opaque
--table-sticky-backgroundthe pinned column already uses, so one override covers both.Changes to Table itself
Three, all consequences of this plugin putting new pinned things inside Table's scroll wrapper.
The wrapper isolates itself.
spec:AST-027listsTableScrollWrapperas a confirmed leak — sticky header and body cells, the row overlay, and the resize handle all rank inside an unisolated element — with "isolateTableScrollWrapper" as the remediation. Adding a header tier and a group-heading tier makes that this change's problem to fix, and it is one declaration.The tiers come from one table.
plugins/stickyTiers.stylex.tsnow owns the four ranks. A pinned group heading and the pinned header row were both at2, which only worked while--table-sticky-header-heightwas current; one frame between a header resize and the variable catching up and the order fell back to DOM position. They hold separate tiers now, and the set is documented in one place rather than three plugins each picking a number.Two plugin-API fixes. A scroll-wrapper plugin's
classNameandstylewere being overwritten by the wrapper's own merge, so neither was a usable channel. And a plugin can now sethasPluginOwnedOverflowto take the wrapper's overflow over entirely — without it, Table'soverflow-x: autoand the hook's measured overflow would both land on the element and resolve by CSS source order.Tests
The full
packages/core/src/Tablesuite passes: 564 tests, 27 files.jsdom lays nothing out, so the shared hook can never measure overflow there and correctly reports every table as fitting. That makes jsdom the right place to prove the fitting half of FR21 — a table with nothing to scroll does not pin — while
hasPersistentContainmentexercises the pinned half, including both plugin orders and the corner tier. The fitting→overflowing transition itself needs real-browser coverage.Also ships
useTableStickyHeader.doc.mjs, four Storybook stories (PinHeader,ViewportHeight,WithStickyColumns,HeightFromAncestor), and two CLI template blocks.For the spec owner
component:Tableisauthority: currentand owned by @cixzhang. This change adds two facts that record does not yet carry — the scroll wrapper is an isolation owner, and a plugin may take over its overflow — and I have not edited an approved record to assert them. They want either an amendment toTable.spec.mdor a note that they belong tospec:AST-025's Table adoption (FR19) instead.