fix(client): prevent checkbox click from triggering link navigation

This commit is contained in:
2026-01-26 13:05:16 +00:00
parent 3bc9a16cd1
commit a160652322
2 changed files with 33 additions and 0 deletions

View File

@@ -18,6 +18,38 @@ vi.mock('@/contexts/project-state', () => ({
useProjects: () => ({ activeProject: { id: 'project-123' } }),
}));
// Mock Checkbox to properly simulate onCheckedChange in jsdom
// Radix UI's onCheckedChange doesn't fire with fireEvent.click when onClick has preventDefault
vi.mock('@/components/ui/checkbox', () => ({
Checkbox: ({
checked,
onCheckedChange,
onClick,
disabled,
'aria-label': ariaLabel,
}: {
checked?: boolean;
onCheckedChange?: (next: boolean) => void;
onClick?: (e: React.MouseEvent) => void;
disabled?: boolean;
'aria-label'?: string;
}) => (
<button
type="button"
role="checkbox"
aria-checked={checked}
aria-label={ariaLabel}
disabled={disabled}
onClick={(e) => {
onClick?.(e);
if (!disabled) {
onCheckedChange?.(!checked);
}
}}
/>
),
}));
// Location tracker component to verify navigation behavior
function LocationTracker({ onLocationChange }: { onLocationChange: (path: string) => void }) {
const location = useLocation();

View File

@@ -62,6 +62,7 @@ export const MeetingCard = forwardRef<HTMLDivElement, MeetingCardProps>(function
disabled={meeting.state === 'recording'}
onCheckedChange={(checked) => onSelect?.(meeting.id, checked as boolean)}
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
}}
aria-label={`Select meeting: ${meeting.title}`}