Skip to content

Commit

Permalink
ui-core: remove HTMLLabelElement from radio button props
Browse files Browse the repository at this point in the history
These props are forwarded to an <input> element, they are never
passed to a <label> element.

Signed-off-by: Simon Ser <[email protected]>
  • Loading branch information
emersion committed Jan 10, 2025
1 parent 1c3c611 commit 92bbf29
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions ui-core/src/components/inputs/RadioButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import cx from 'classnames';

import useFocusByTab from '../../hooks/useFocusByTab';

export type RadioButtonProps = Omit<
React.InputHTMLAttributes<HTMLInputElement | HTMLLabelElement>,
'value'
> & {
export type RadioButtonProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value'> & {
label: string;
value: string;
hint?: string;
Expand Down
5 changes: 1 addition & 4 deletions ui-core/src/components/inputs/RadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ const RadioGroup = ({
}: RadioGroupProps) => {
const [selectedValue, setSelectedValue] = useState<string | undefined>(value);

const handleOptionChange = (
e: ChangeEvent<HTMLInputElement | HTMLLabelElement>,
nextOption: RadioButtonProps
) => {
const handleOptionChange = (e: ChangeEvent<HTMLInputElement>, nextOption: RadioButtonProps) => {
if (!readOnly) {
setSelectedValue(nextOption.value);
nextOption.onChange?.(e);
Expand Down

0 comments on commit 92bbf29

Please sign in to comment.