Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/tedi/components/form/radio/radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const Radio = (props: RadioProps): JSX.Element => {
invalid,
...rest
} = props;

const [innerChecked, setInnerChecked] = React.useState<boolean>(defaultChecked || false);
const labelRef = React.useRef<HTMLLabelElement>(null);

Expand All @@ -42,7 +43,9 @@ export const Radio = (props: RadioProps): JSX.Element => {
onChange?.(value, event?.target.checked);
};

const helperId = helper ? helper?.id ?? `${id}-helper` : undefined;
const helperId = helper ? helper.id ?? `${id}-helper` : undefined;
const tooltipId = tooltip ? `${id}-tooltip` : undefined;

const LabelBEM = cn(styles['tedi-radio'], { [styles['tedi-radio--disabled']]: disabled });

return (
Expand All @@ -59,6 +62,7 @@ export const Radio = (props: RadioProps): JSX.Element => {
checked={getChecked}
onChange={onChangeHandler}
className={styles['tedi-radio__input']}
aria-describedby={[helperId, tooltipId].filter(Boolean).join(' ')}
/>
<div
aria-hidden="true"
Expand Down
Loading