Skip to content

Commit

Permalink
fix: prevent console warning in checkbox & radio (#10048)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolethoen committed Jan 29, 2024
1 parent f62813f commit 8709f20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/react-core/src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class Checkbox extends React.Component<CheckboxProps, CheckboxState> {
const labelRendered = label ? (
<Label
className={css(styles.checkLabel, isDisabled && styles.modifiers.disabled)}
htmlFor={!wrapWithLabel && props.id}
htmlFor={!wrapWithLabel ? props.id : undefined}
>
{label}
{isRequired && (
Expand All @@ -154,7 +154,7 @@ class Checkbox extends React.Component<CheckboxProps, CheckboxState> {
return (
<Component
className={css(styles.check, !label && styles.modifiers.standalone, className)}
htmlFor={wrapWithLabel && props.id}
htmlFor={wrapWithLabel ? props.id : undefined}
>
{isLabelBeforeButton ? (
<>
Expand Down
4 changes: 2 additions & 2 deletions packages/react-core/src/components/Radio/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class Radio extends React.Component<RadioProps, { ouiaStateId: string }> {
const labelRendered = label ? (
<Label
className={css(styles.radioLabel, isDisabled && styles.modifiers.disabled)}
htmlFor={!wrapWithLabel && props.id}
htmlFor={!wrapWithLabel ? props.id : undefined}
>
{label}
</Label>
Expand All @@ -130,7 +130,7 @@ class Radio extends React.Component<RadioProps, { ouiaStateId: string }> {
return (
<Component
className={css(styles.radio, !label && styles.modifiers.standalone, className)}
htmlFor={wrapWithLabel && props.id}
htmlFor={wrapWithLabel ? props.id : undefined}
>
{isLabelBeforeButton ? (
<>
Expand Down

0 comments on commit 8709f20

Please sign in to comment.