Skip to content

Commit

Permalink
Fix MUI/material-ui RangeWidget missing htmlFor and schema.title (rjs…
Browse files Browse the repository at this point in the history
…f-team#3281)

* match FormLabel component with other widgets

* update changelog

* update test snapshots
  • Loading branch information
kyleawayan authored and shijistar committed Jun 8, 2023
1 parent b81bbc0 commit 4dc64c8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
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

0 comments on commit 4dc64c8

Please sign in to comment.