default checkbox value to undefined if it is false

This commit is contained in:
jasquat 2023-09-18 11:45:24 -04:00
parent 691611c695
commit 4136917a3a
1 changed files with 7 additions and 0 deletions

View File

@ -42,6 +42,13 @@ function CheckboxWidget(props: WidgetProps) {
rawErrors
);
// if the default value is false then set the value to undefined
// so it will fail validation. in practice, there is no other
// way that this prop could have the value false. it has to be the default.
if (value === false) {
onChange(undefined);
}
// if the parent rjsf schema is not of type "object", then rjsf sends "root" through as the id.
// this creates issues with the carbon checkbox where it will not accept any clicks to the checkbox
// so add fuzz to the id to ensure it is unique.