Skip to content

Fix 4134 by filtering out bad DOM props #4140

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

Merged
merged 1 commit into from
Mar 22, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,23 @@ should change the heading of the (upcoming) version to include a major version b

# 5.18.0

## @rjsf/antd
- Fix issue where the theme provided by the ConfigProvider under antd v5 wasn't respected thereby rendering the form items unusable under dark themes [#4129](https://github.com/rjsf-team/react-jsonschema-form/issues/4129)

## @rjsf/core

- Fix Error state not resetting when schema changes [#4079](https://github.com/rjsf-team/react-jsonschema-form/issues/4079)

## @rjsf/mui

- Fixed the `SelectWidget` and `BaseInputTemplate` to filter out `errorSchema` and `autocomplete` from the `textFieldProps` being spread onto the `TextField`, fixing [#4134](https://github.com/rjsf-team/react-jsonschema-form/issues/4134)

## @rjsf/utils

- Added a new `skipEmptyDefault` option in `emptyObjectFields`, fixing [#3880](https://github.com/rjsf-team/react-jsonschema-form/issues/3880)
- Added a new `computeSkipPopulate` option in `arrayMinItems`, allowing custom logic to skip populating arrays with default values, implementing [#4121](https://github.com/rjsf-team/react-jsonschema-form/pull/4121).
- Fixed bug where the string `"\</strong>"` would get printed next to filenames when uploading files, and restored intended bolding of filenames fixing [#4120](https://github.com/rjsf-team/react-jsonschema-form/issues/4120).

## @rjsf/antd
- Fix issue where the theme provided by the ConfigProvider under antd v5 wasn't respected thereby rendering the form items unusable under dark themes [#4129](https://github.com/rjsf-team/react-jsonschema-form/issues/4129)

## Dev / docs / playground

- Updated the documentation to describe how to use the `skipEmptyDefault` option.
Expand Down
1 change: 1 addition & 0 deletions packages/mui/src/BaseInputTemplate/BaseInputTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default function BaseInputTemplate<
schema,
uiSchema,
rawErrors = [],
errorSchema,
formContext,
registry,
InputLabelProps,
Expand Down
9 changes: 6 additions & 3 deletions packages/mui/src/SelectWidget/SelectWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default function SelectWidget<
onChange,
onBlur,
onFocus,
errorSchema,
rawErrors = [],
registry,
uiSchema,
Expand All @@ -59,6 +60,7 @@ export default function SelectWidget<
const _onFocus = ({ target: { value } }: FocusEvent<HTMLInputElement>) =>
onFocus(id, enumOptionsValueForIndex<S>(value, enumOptions, optEmptyVal));
const selectedIndexes = enumOptionsIndexForValue<S>(value, enumOptions, multiple);
const { InputLabelProps, SelectProps, autocomplete, ...textFieldRemainingProps } = textFieldProps;

return (
<TextField
Expand All @@ -69,19 +71,20 @@ export default function SelectWidget<
required={required}
disabled={disabled || readonly}
autoFocus={autofocus}
autoComplete={autocomplete}
placeholder={placeholder}
error={rawErrors.length > 0}
onChange={_onChange}
onBlur={_onBlur}
onFocus={_onFocus}
{...(textFieldProps as TextFieldProps)}
{...(textFieldRemainingProps as TextFieldProps)}
select // Apply this and the following props after the potential overrides defined in textFieldProps
InputLabelProps={{
...textFieldProps.InputLabelProps,
...InputLabelProps,
shrink: !isEmpty,
}}
SelectProps={{
...textFieldProps.SelectProps,
...SelectProps,
multiple,
}}
aria-describedby={ariaDescribedByIds<T>(id)}
Expand Down