fix: optional number inputs (#20218)

This commit is contained in:
Daniel Dietzler 2025-07-25 15:06:12 +02:00 committed by GitHub
parent 13281f8531
commit edefed56ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -46,6 +46,6 @@ describe('SettingInputField component', () => {
expect(numberInput.value).toEqual('');
await user.click(document.body);
expect(numberInput.value).toEqual('0');
expect(numberInput.value).toEqual('');
});
});

View File

@ -49,6 +49,11 @@
value = e.currentTarget.value;
if (inputType === SettingInputFieldType.NUMBER) {
if (value === '' && !required) {
value = null;
return;
}
let newValue = Number(value) || 0;
if (newValue < min) {
newValue = min;