refactor(date-field): add RHF component contracts - #413
Draft
IzumiSy wants to merge 7 commits into
Draft
Conversation
IzumiSy
force-pushed
the
test/rhf-component-contracts
branch
from
July 31, 2026 03:52
d271c00 to
412dfc5
Compare
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.
Motivation
The date controls on this branch already move away from Base UI's internal
Field/Formwiring and toward a standalone composite-control model.At the same time, AppShell needs a reliable way to keep form controls compatible with React Hook Form. That compatibility is important enough to treat as an API contract, not just an example or documentation pattern.
Today we have docs and demo usage for RHF, but we do not have component-level tests that exercise real
useForm/Controllerintegration across the control set. That leaves a gap for future form-component work: a refactor can quietly breakvalue,onChange,onBlur,ref, reset behavior, or error rendering without a focused test failing.This PR closes that gap by adding RHF-backed component tests for the core form controls while also carrying the date-field standalone wiring change.
Design Decision
Date controls stay aligned with Base UI's public composition model
DateFieldandDatePickerare AppShell-owned composite widgets rather than built-in Base UI field controls. Full automaticField.Rootintegration required reaching into Base UI internal context and field-registration APIs.This branch keeps the simpler standalone contract instead:
id/ label wiringaria-labelledbyaria-describedbyisInvalidThat keeps the date controls on Base UI's supported public surface instead of depending on internal wiring.
RHF compatibility is tested as a control contract
For form-oriented components, RHF interoperability is now treated as a first-class compatibility requirement.
A shared RHF test harness was added so component tests can exercise real
useForm/Controllerflows with minimal boilerplate. The tests focus on the behavior we want to preserve across refactors:Scope of RHF coverage
This PR adds RHF component tests for the controls where integration matters most:
FieldFormInputCheckboxSelectComboboxAutocompleteDateField/DatePickerThe intent is not to test RHF itself, but to lock down the AppShell-side contract those components promise to consumers.
Summary
DateField/DatePickeras standalone composite controls instead of depending on Base UI internal field wiringreact-hook-formas a test-only dependency forpackages/core