Skip to content
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

Fix MUI/material-ui RangeWidget missing htmlFor and schema.title #3281

Merged
merged 3 commits into from Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -24,6 +24,12 @@ should change the heading of the (upcoming) version to include a major version b
- Added `ref` definition to `ThemeProps` fixing [#2135](https://github.com/rjsf-team/react-jsonschema-form/issues/2135)
- Updated the `onChange` handler in `Form` to use the new `preventDuplicates` mode of `mergeObjects()` when merging `extraErrors` when live validation is off, fixing [#3169](https://github.com/rjsf-team/react-jsonschema-form/issues/3169)

## @rjsf/material-ui
- Fix RangeWidget missing htmlFor and schema.title [#3281](https://github.com/rjsf-team/react-jsonschema-form/pull/3281)

## @rjsf/mui
- Fix RangeWidget missing htmlFor and schema.title [#3281](https://github.com/rjsf-team/react-jsonschema-form/pull/3281)

## @rjsf/utils
- Updated `computedDefaults` (used by `getDefaultFormState`) to skip saving the computed default if it's an empty object unless `includeUndefinedValues` is truthy, fixing [#2150](https://github.com/rjsf-team/react-jsonschema-form/issues/2150) and [#2708](https://github.com/rjsf-team/react-jsonschema-form/issues/2708)
- Expanded the `getDefaultFormState` util's `includeUndefinedValues` prop to accept a boolean or `"excludeObjectChildren"` if it does not want to include undefined values in nested objects
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/RangeWidget/RangeWidget.tsx
Expand Up @@ -29,8 +29,8 @@ const RangeWidget = ({

return (
<>
<FormLabel required={required} id={id}>
{label}
<FormLabel required={required} htmlFor={id}>
{label || schema.title}
</FormLabel>
<Slider
disabled={disabled || readonly}
Expand Down
6 changes: 2 additions & 4 deletions packages/material-ui/test/__snapshots__/Form.test.tsx.snap
Expand Up @@ -1821,10 +1821,8 @@ exports[`single fields slider field 1`] = `
>
<label
className="MuiFormLabel-root"
id="root"
>
</label>
htmlFor="root"
/>
<span
className="MuiSlider-root MuiSlider-colorPrimary"
id="root"
Expand Down
4 changes: 2 additions & 2 deletions packages/mui/src/RangeWidget/RangeWidget.tsx
Expand Up @@ -29,8 +29,8 @@ const RangeWidget = ({

return (
<>
<FormLabel required={required} id={id}>
{label}
<FormLabel required={required} htmlFor={id}>
{label || schema.title}
</FormLabel>
<Slider
disabled={disabled || readonly}
Expand Down
6 changes: 2 additions & 4 deletions packages/mui/test/__snapshots__/Form.test.tsx.snap
Expand Up @@ -8130,10 +8130,8 @@ exports[`single fields slider field 1`] = `
>
<label
className="MuiFormLabel-root MuiFormLabel-colorPrimary emotion-1"
id="root"
>
</label>
htmlFor="root"
/>
<span
className="MuiSlider-root MuiSlider-colorPrimary MuiSlider-sizeMedium emotion-2"
id="root"
Expand Down