Skip to content

Commit

Permalink
fix: ui.radio value defaulting (deephaven#818)
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshatJawne authored Sep 21, 2024
1 parent 011c03d commit 5581ae4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugins/ui/src/js/src/elements/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,29 @@ export function Radio({
onBlur: serializedOnBlur,
onKeyDown: serializedOnKeyDown,
onKeyUp: serializedOnKeyUp,
value: valueProp,
children,
...props
}: SerializedRadioProps): JSX.Element {
const onFocus = useFocusEventCallback(serializedOnFocus);
const onBlur = useFocusEventCallback(serializedOnBlur);
const onKeyDown = useKeyboardEventCallback(serializedOnKeyDown);
const onKeyUp = useKeyboardEventCallback(serializedOnKeyUp);

const value = valueProp ?? (typeof children === 'string' ? children : '');

return (
<DHRadio
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
value={value}
onFocus={onFocus}
onBlur={onBlur}
onKeyDown={onKeyDown}
onKeyUp={onKeyUp}
/>
>
{children}
</DHRadio>
);
}

Expand Down

0 comments on commit 5581ae4

Please sign in to comment.