Repository navigation
feat(core): opt-in bulk-actions toolbar for useTableSelection (#5486) - #5489
humbertovirtudes merged 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression1 of 420 shot(s) changed. View the report A change here is a question, not a failure: check whether the after is the
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
3305d1c to
759661f
Compare
|
The bulk-actions behavior looks good. I have one visual spacing suggestion after testing it inside a padded Card: the outlined toolbar currently reads as another full-width container and feels cramped against the surrounding layout. Could we remove the toolbar border and inset the tinted surface by 8px on each logical inline side? That offset comes from the actual selection geometry: a 20px small checkbox centered in the 36px selection column. It aligns the toolbar surface with the outer edge of the checkboxes while allowing the table rows to remain full bleed. |
|
I recreated a table template trying to replicate what we had in www. The bulk actions bar here is a full bleed section. With actions on the left side, and unselection and total selected count on the right. Mainly because the column heading also has a bulk checkbox already anyways so colocating the actions to be close by seems to make more sense. |
ernestt
left a comment
There was a problem hiding this comment.
Bulk action bar visuals commented above
|
@ernestt Im thinking we can have 2 variants for bulk action bars - one that remains at the top of the table, full bleed and static as you suggested, and another that is floating - and remains visible even when the user scrolled way past the header - to avoid having to scroll back to the top in order to trigger any bulk actions. Thoughts? |
759661f to
8b27207
Compare
8b27207 to
0882bd3
Compare
0882bd3 to
d1f1234
Compare
fedccc8 to
36bd769
Compare
There was a problem hiding this comment.
Approval is waiting on a maintainer to provide or identify the current governing specs for the new public TableSelectionToolbar / selectionState contract, including complete-clear behavior and the fixed/floating placement recipes, and for production registry omission of blocks that depend on unreleased components.
One implementation issue remains independently actionable: the floating story and copyable template pair vertical scrolling with overscrollBehavior: 'contain', which contains both axes. The current scrolling contract requires containment only on axes that actually overflow, so please scope this to the block axis or use the shared effective-scroll behavior.
Browser behavior was not independently rerun in this review.
[Automated review]
36bd769 to
04cdbf3
Compare
There was a problem hiding this comment.
Approval is waiting on a maintainer to provide or identify the current governing specs for the new public TableSelectionToolbar / selectionState contract, including complete-clear behavior and the fixed/floating placement recipes, and for omitting blocks that depend on unreleased components from the latest registry.
One implementation issue remains independently actionable: the floating story and copyable template pair block scrolling with overscrollBehavior: 'contain', which contains both axes. The current scrolling contract requires containment only on axes that actually overflow, so please scope this to the block axis or use the shared effective-scroll behavior.
Browser behavior was not independently rerun in this review.
[Automated review]
|
The behavior here is good — I'm happy with how the floating toolbar reads and with the ownership split between the plugin, the wrapper, and the callsite. In particular, keeping the toolbar outside Table's inline-axis scroll wrapper is the right call and is exactly what What I'd like you to look at before this lands is whether the example scrollport can conform to the sticky/scrollable-area specs, since this is a CLI template and a Storybook story — whatever it does gets copied into consumer apps. Concretely, in
All three fall out for free if the example wraps the region in Two smaller things while you're in there:
None of this changes what the toolbar does — it's all the container around it. Happy to pair on the |
04cdbf3 to
af4df47
Compare
af4df47 to
07bdde8
Compare
07bdde8 to
11503af
Compare
There was a problem hiding this comment.
Approval is waiting on a maintainer to provide or identify the governing spec for the new public TableSelectionToolbar / selectionState contract — including complete-clear behavior, the sm/muted and localized-label defaults, and the fixed and floating placement recipes — and for omitting blocks that depend on unreleased components from the latest registry. The current Table, Toolbar, and scrolling specs cover the adjacent mechanics, but they do not settle this new public addition, and the registry compatibility record is still draft.
The implementation issues raised in earlier revisions are resolved in this revision: the floating examples now use ScrollableArea with containment only on the overflowing block axis, real Toolbar delegation, and local stacking inside an isolated surface.
Browser behavior was not independently rerun in this review.
[Automated review]
Add TableSelectionToolbar as a reusable selection-aware wrapper built on Toolbar. Extend useTableSelectionState with selectionState for synchronized selected keys, count, visibility, and complete clearing while keeping useTableSelection behavior-only. Use the wrapper in fixed and floating Storybook and website examples. The floating website example fills its available width while retaining a capped internal scroll region, uses compact equal-width content columns to avoid horizontal overflow, reserves toolbar space, keeps the toolbar 16px from the scrollport, and does not move the table when selection changes. Keep the hidden production ShadCN registry compatible with the latest stable package by requiring both a published import subpath and published component metadata before emitting a block. Add public docs, exports, localized defaults, the ShadCN route lock, the reviewed documentation and sandbox route inventories, and a patch changeset. Closes meta#5486. Refs meta#6474. **This diff was generated with AI assistance (Navi).** The implementation, regression coverage, validation, and review-feedback updates were produced with AI assistance. The human author reviewed and approved the changes. *Crafted with care by Navi* Tags: ai-generated
11503af to
ab4737a
Compare
There was a problem hiding this comment.
Approval is waiting on a maintainer to provide or identify the governing spec for the new public TableSelectionToolbar / selectionState contract — including complete-clear behavior, the sm/muted and localized-label defaults, and the fixed and floating placement recipes — and for omitting blocks that depend on unreleased components from the latest registry. The current Table, Toolbar, and scrolling specs cover the adjacent mechanics, but they do not settle this new public addition, and the registry compatibility record is still draft.
Two implementation issues also need fixing:
- The new latest-registry check drops existing released blocks. It compares
componentsUsedagainst published component-entry names, but the three ChatDictation examples listChatDictationand the NavHeadingMenu showcase listsNavHeadingMenuItem— neither is a component-entry name, even though both blocks import only published package paths. Please gate on the imported exports or correct those entries, and add a regression showing existing released blocks stay in the latest registry. - Activating "Unselect All" removes the toolbar and its focused button with no focus restoration, leaving keyboard focus on the document body. Please define and test where focus goes when clearing removes the toolbar.
Browser behavior was not independently rerun in this review.
[Automated review]





TL;DR This PR adds a reusable
TableSelectionToolbarthat consumes sharedselectionStatefromuseTableSelectionState.useTableSelectionremains behavior-only, while product callsites own actions and fixed or floating placement.Closes #5486.
Follows up in #6474.
Problem
Row selection is common Table behavior, but bulk-action UI is product chrome. Putting action labels, handlers, copy, or layout inside
useTableSelectionwould couple a behavioral plugin to one visual pattern.The selection plugin should remain reusable without rendering React chrome. A separate component can consume the same controlled selection source so behavior and presentation remain synchronized.
What changed
selectionStateoutput touseTableSelectionStatewithselectedKeys,selectedCount,hasSelection, and completeclearSelection.TableSelectionToolbar, built on AstryxToolbar.useTableSelectionbehavior-only. It still owns row controls, select-all behavior, callbacks, and selected-row semantics.ScrollableAreawith logical block scrolling, conditional containment and focusability, and stable scrollbar geometry.Usage
selectionState.clearSelection()clears the complete controlled selection, including keys retained outside the current filtered or paginated view. The header checkbox keeps its existing view-scoped deselection behavior and preserves frozen keys.Ownership boundary
useTableSelectionowns:TableSelectionToolbarowns:Toolbardelegationsmsize andmutedvariantThe product callsite owns:
Layout variants
The floating recipe keeps the toolbar outside Table's horizontal overflow wrapper, reserves its layout space so selection causes zero table movement, and pins the rendered surface 16px from the example scrollport.
Test plan
sm,muted, synchronized count, complete clear, and outside Table's horizontal scroller.ScrollableAreahad 1725px of scroll content, used a named default group with a tab stop while block overflow was active, contained overscroll only on the overflowing block axis, caused zero table movement, used localz-index: 1, and kept the toolbar 16px from the scrollport atscrollTop=300.Review links
Self-review
The post-publish review found and fixed one callback edge case:
renderSelectionLabel={() => null}now intentionally renders no count instead of falling back to the default count. The final review follow-up replaced the hand-rolled floating scrollport withScrollableArea, removed the nested Metrics region, scoped sticky stacking locally, and consolidated its placement geometry. The rebase retained main's source-import registry compatibility check; the CI follow-up added the complementary published-component guard needed when a new named export uses an existing package subpath. The adversarial follow-up found no blocker. Residual risk: named-export gating relies on accurate blockcomponentsUsedmetadata, with the published-package compile remaining the final backstop. Preview links depend on the PR deployment finishing for commitab4737a1e3420bc510083c6ffedc91bf6c40dfae.This PR was generated with AI assistance. The human author reviewed and approved the changes.