Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent console warning in checkbox & radio #10048

Merged
Merged
Show file tree
Hide file tree
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
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
Loading