-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: Add FieldContext to pass props to controls inside Field #27399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📊 Bundle size reportUnchanged fixtures
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: f196c2eb9fe14dbfca668815fc20925cb7618d19 (build) |
🕵 fluentuiv9 No visual regressions between this PR and main |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 3423379:
|
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| Avatar | mount | 930 | 922 | 5000 | |
| Button | mount | 572 | 573 | 5000 | |
| Field | mount | 1635 | 1643 | 5000 | |
| FluentProvider | mount | 1176 | 1185 | 5000 | |
| FluentProviderWithTheme | mount | 304 | 324 | 10 | |
| FluentProviderWithTheme | virtual-rerender | 278 | 275 | 10 | |
| FluentProviderWithTheme | virtual-rerender-with-unmount | 298 | 299 | 10 | |
| InfoButton | mount | 210 | 193 | 5000 | |
| MakeStyles | mount | 1314 | 1309 | 50000 | |
| Persona | mount | 2249 | 2228 | 5000 | |
| SpinButton | mount | 2013 | 1982 | 5000 |
packages/react-components/react-field/src/components/Field/Field.test.tsx
Show resolved
Hide resolved
packages/react-components/react-field/src/components/Field/Field.test.tsx
Show resolved
Hide resolved
packages/react-components/react-field/src/contexts/useFieldContextValues.ts
Show resolved
Hide resolved
I think it's because it had more logic related to merging props, in addition to importing |
packages/react-components/react-field/stories/Field/FieldRenderFunction.stories.tsx
Outdated
Show resolved
Hide resolved
packages/react-components/react-field/src/contexts/useFieldControlProps.ts
Show resolved
Hide resolved
…self at the same time


Previous Behavior
Fieldreads and modifies the props of its child elements, in order to set up thearia-labelledby, etc. associations between the control and the labels in the Field.This works fine in common, simple cases where the control is the direct child of the field. However, some form validation libraries require inserting a React component around the control, as is the case with #27202. This component interferes with the prop setting approach that Field was using.
New Behavior
FieldContextto pass information about the Field to its child elements.useFieldControlProps_unstablefor controls to use to merge field props from the context.Related Issue(s)