Skip to content

Commit

Permalink
Fix selection bug caused by too generic ids
Browse files Browse the repository at this point in the history
  • Loading branch information
thomheymann committed Mar 26, 2024
1 parent 3bd22d7 commit 34bc85d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
EuiFlexGrid,
EuiAvatar,
useEuiTheme,
useGeneratedHtmlId,
} from '@elastic/eui';

interface UseCaseOption {
Expand Down Expand Up @@ -159,6 +160,7 @@ export const OnboardingFlowForm: FunctionComponent = () => {
},
];

const radioGroupId = useGeneratedHtmlId({ prefix: 'onboardingUseCase' });
const [selectedId, setSelectedId] = useState<string>();
const [hoveredId, setHoveredId] = useState<string>();

Expand Down Expand Up @@ -194,7 +196,8 @@ export const OnboardingFlowForm: FunctionComponent = () => {
{/* Using EuiSpacer instead of EuiFlexGroup to ensure spacing is part of hit area for mouse hover effect */}
{index > 0 && <EuiSpacer size="m" />}
<EuiCheckableCard
id={option.id}
id={`${radioGroupId}_${option.id}`}
name={radioGroupId}
label={option.label}
checked={selectedId === option.id}
onChange={() => setSelectedId(option.id)}
Expand Down

0 comments on commit 34bc85d

Please sign in to comment.