Repository navigation
fix(core): forward pass-through attributes on native-root components - #3871
Merged
Merged
Conversation
…omponents Switch, Pagination, RadioListItem, SideNavSection, TableHeader/Body/Footer, and TopNavMegaMenuFeaturedCard captured no ...rest, so pass-through attributes (data-testid, aria-*, id, etc.) not explicitly consumed were silently dropped. Capture ...rest and spread it onto the primary rendered element after mergeProps() and before component-owned contract props (role, owned aria, data-testid) so className/style/xstyle still combine and the component keeps precedence over its contract props. RadioListItem's manual data-testid-only forward is replaced with a full ...rest spread and now also merges xstyle/className/style.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
josephfarina
approved these changes
Jul 12, 2026
Contributor
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: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Several native-root components extend
BaseProps(or aPick/Omitof it) but never captured...rest, so any pass-through attribute they didn't explicitly consume —data-testid,aria-*,id,tabIndex, neutral event handlers — was silently dropped. This fixes the same "rest-forwarding / prop-collision" bug class addressed in #3738 / #3852 / #3869 for a cluster of non-Chat native-root components.Each fixed component now captures
...restand spreads it onto its primary rendered element, placed aftermergeProps(...)(soclassName/style/xstylestill combine) and before the component-owned contract props (role, ownedaria-*, computedid,data-testid) so the component keeps precedence over its own contract.Components fixed (with the previously-dropped attributes)
Switch<div>(switch-field)data-testid,aria-*,id, all neutral pass-throughsPagination<nav>data-testid(e.g.id,aria-describedby)RadioListItem<div>data-testid; alsoxstyle/className/stylewere declared on the interface but never applied — now mergedSideNavSection<div>data-testid/className/style(e.g.id,aria-describedby)TableHeader/TableBody/TableFooter<thead>/<tbody>/<tfoot>className,style,data-testid,id,aria-*— onlyxstylewas appliedTopNavMegaMenuFeaturedCard<div>xstyle,className,style,data-testid,id,aria-*(none were consumed or forwarded)Each fix ships with a colocated test asserting a
data-testid/id/aria-*now reaches the DOM.Precedence details
className/style/xstylecombine viamergeProps.role, ownedaria-labelledby,data-testid) are set after{...rest}so the component wins.composeEventHandlerscomposition was needed here.Needs Review (intentionally NOT changed)
MetadataListItem— renders two different shapes depending on layout: a single wrapper<div>in stacked mode, but a bare<dt>+<dd>Fragment in inline mode (wheredata-testidis deliberately split into-label/-valuesuffixes). There is no single primary element in inline mode, so forwarding arbitrary...restwould behave inconsistently between the two layouts. Left as-is pending a decision on where inline-mode pass-throughs should land.TabMenu— its props interface is intentionally narrow:Pick<BaseProps<HTMLButtonElement>, 'xstyle' | 'className' | 'style'>only. It does not exposedata-testidoraria-*in its public contract, so there is no pass-through surface to forward and adding...restwould widen the API beyond what the type declares. Left as-is.Testing
pnpm -F @astryxdesign/core typecheck— cleanvitest runacross all affected dirs (Switch, Pagination, RadioList, SideNav, Table, TopNav) — 634 passedpnpm -F @astryxdesign/core build— succeedseslinton all changed files — cleanCredit: @cixzhang