Skip to content

Commit 6c45fdf

Browse files
committed
fix: html
1 parent f93b1e9 commit 6c45fdf

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

apps/dashboard/app/(main)/websites/[id]/_components/tabs/tracking-setup-tab.tsx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -386,37 +386,28 @@ function OptionToggle({
386386
onToggle: () => void;
387387
}) {
388388
const isEnabled = option.inverted ? !enabled : enabled;
389-
390-
const handleKeyDown = (event: React.KeyboardEvent) => {
391-
if (event.key === "Enter" || event.key === " ") {
392-
event.preventDefault();
393-
onToggle();
394-
}
395-
};
389+
const switchId = `switch-${option.key}`;
396390

397391
return (
398-
<div
392+
<label
399393
className={cn(
400394
"group flex w-full cursor-pointer items-center gap-3 rounded border p-3 text-left transition-all",
401395
"hover:border-primary/50 hover:bg-accent/50",
402396
isEnabled && "border-primary/30 bg-primary/5"
403397
)}
404-
onClick={onToggle}
405-
onKeyDown={handleKeyDown}
406-
role="button"
407-
tabIndex={0}
398+
htmlFor={switchId}
408399
>
409400
<Switch
410401
checked={isEnabled}
411402
className="shrink-0"
403+
id={switchId}
412404
onCheckedChange={onToggle}
413-
onClick={(e) => e.stopPropagation()}
414405
/>
415406
<div className="min-w-0 flex-1">
416407
<span className="font-medium text-sm">{option.title}</span>
417408
<p className="text-muted-foreground text-xs">{option.description}</p>
418409
</div>
419-
</div>
410+
</label>
420411
);
421412
}
422413

0 commit comments

Comments
 (0)