fix(client): prevent checkbox click from triggering link navigation
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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}`}
|
||||
|
||||
Reference in New Issue
Block a user