File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed
apps/dashboard/app/(main)/websites/[id]/_components/tabs Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments