diff --git a/components/lib/checkbox/Checkbox.js b/components/lib/checkbox/Checkbox.js index da8ec025a7..fa7b0e9193 100644 --- a/components/lib/checkbox/Checkbox.js +++ b/components/lib/checkbox/Checkbox.js @@ -56,7 +56,7 @@ export const Checkbox = React.memo( } }; - props.onChange && props.onChange(eventData); + props?.onChange?.(eventData); // do not continue if the user defined click wants to prevent if (event.defaultPrevented) { diff --git a/components/lib/radiobutton/RadioButton.js b/components/lib/radiobutton/RadioButton.js index e616120f78..19dff128ad 100644 --- a/components/lib/radiobutton/RadioButton.js +++ b/components/lib/radiobutton/RadioButton.js @@ -57,16 +57,14 @@ export const RadioButton = React.memo( } }; - props?.onChange?.(eventData); - - // do not continue if the user defined click wants to prevent - if (event.defaultPrevented) { - return; - } - if (isInputToggled || isRadioToggled) { props?.onChange?.(eventData); + // do not continue if the user defined click wants to prevent + if (event.defaultPrevented) { + return; + } + if (isRadioToggled) { inputRef.current.checked = value; } @@ -163,7 +161,7 @@ export const RadioButton = React.memo( return (