Skip to content

Commit 7d70d8d

Browse files
authored
Align Mantine’s behavior with other themes when clearing string fields (#4875)
* Fix: Align Mantine’s behavior with other themes when clearing string fields * Update CHANGELOG.md
1 parent a62510d commit 7d70d8d

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ it according to semantic versioning. For example, if your PR adds a breaking cha
1515
should change the heading of the (upcoming) version to include a major version bump.
1616
1717
-->
18+
# 6.1.2
19+
20+
## @rjsf/mantine
21+
22+
Align Mantine’s behavior with other themes when clearing string fields: clearing an input now removes the key from formData instead of setting it to an empty string. ([#4875](https://github.com/rjsf-team/react-jsonschema-form/pull/4875))
23+
1824
# 6.1.1
1925

2026
## @rjsf/core

packages/mantine/src/templates/BaseInputTemplate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default function BaseInputTemplate<
5555
const handleChange = useCallback(
5656
(e: ChangeEvent<HTMLInputElement>) => {
5757
const handler = onChangeOverride ? onChangeOverride : onChange;
58-
const value = e.target.value === '' ? (options.emptyValue ?? '') : e.target.value;
58+
const value = e.target.value === '' ? options.emptyValue : e.target.value;
5959
handler(value);
6060
},
6161
[onChange, onChangeOverride, options],

packages/mantine/src/widgets/PasswordWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default function PasswordWidget<
3939
onFocus,
4040
} = props;
4141

42-
const emptyValue = options.emptyValue || '';
42+
const emptyValue = options.emptyValue;
4343
const themeProps = cleanupOptions(options);
4444

4545
const handleChange = useCallback(

packages/mantine/src/widgets/TextareaWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default function TextareaWidget<
4040
} = props;
4141

4242
const themeProps = cleanupOptions(options);
43-
const emptyValue = options?.emptyValue ?? '';
43+
const emptyValue = options?.emptyValue;
4444

4545
const handleChange = useCallback(
4646
(e: ChangeEvent<HTMLTextAreaElement>) => {

0 commit comments

Comments
 (0)