Migrate initial components to mergeProps - #8256
Conversation
|
|
f791ad9 to
d6b13d8
Compare
There was a problem hiding this comment.
Pull request overview
This PR implements the first bounded ADR-025 batch by migrating three component patterns (VisuallyHidden, TokenBase, Radio) to use mergeProps, aiming to standardize className merging and event-handler composition semantics.
Changes:
VisuallyHidden: switch tomergePropsfor composing component and consumerclassName.TokenBase: move keyboard removal behavior into a component handler and compose it with consumeronKeyDownviamergeProps(with a new ordering test).Radio: enforce thetype="radio"invariant at the type level and compose RadioGroup context + consumeronChangeviamergeProps(with new runtime and type-level tests).
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/VisuallyHidden/VisuallyHidden.tsx | Replaces clsx usage with mergeProps for className composition. |
| packages/react/src/Token/TokenBase.tsx | Uses mergeProps to compose onKeyDown and className, ensuring component keyboard behavior runs before consumer handlers. |
| packages/react/src/Token/tests/Token.test.tsx | Adds a test asserting removal behavior runs before consumer onKeyDown. |
| packages/react/src/Radio/Radio.types.test.tsx | Adds a type-level invariant test preventing type override. |
| packages/react/src/Radio/Radio.tsx | Uses mergeProps for prop composition and omits type from props to preserve radio semantics. |
| packages/react/src/Radio/Radio.test.tsx | Adds a runtime assertion that rendered input has type="radio". |
Review details
Tip
Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
| {...mergeProps( | ||
| { | ||
| onChange: handleOnChange, | ||
| className: clsx(sharedClasses.Input, classes.Radio), | ||
| 'aria-checked': checked ? ('true' as const) : ('false' as const), | ||
| }, |
d6b13d8 to
d828879
Compare
d6b13d8 to
d828879
Compare
Apply the validated class name, event handler, ref, and component-owned prop patterns in a dedicated implementation batch. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 00bfd295-6ed9-4119-8d63-103a0b3c63e8
d828879 to
68c2e7c
Compare
This PR contains the first bounded ADR-025 implementation batch. It migrates three reviewed component patterns without mixing changes into the tooling foundation or migration driver.
Changelog
New
Changed
VisuallyHiddento merge component and consumer class names throughmergeProps.TokenBaseto run component keyboard behavior before consumer handlers while keeping refs separate.Radioto preserve radio semantics and compose context and consumer change handlers.Removed
Rollout strategy
These changes correct existing component behavior to match the intended contracts. They do not add a supported public capability, so this batch does not include release notes.
Testing & Reviewing
Please review class-name ordering, optional handler composition, ref handling, and the
Radiotype invariant. The migration report should no longer list the three assigned source files.