fix(ui): add focus-visible ring to ToggleSwitch and Sheet close (B1)
Keyboard-a11y polish to match the codebase's standard `focus-visible:ring-[3px] focus-visible:ring-ring/40` treatment: - ToggleSwitch (role=switch, used across every settings/config surface) had no focus-visible ring — keyboard users got no focus indicator. - Sheet's close button used a bare `focus:outline-none`; now mirrors the Dialog close button's ring. Slider, Button, Input, Select, Tabs, Checkbox, Switch already carry the ring.
This commit is contained in:
2 files changed
+2
-1
No files matched your search
@@ -52,7 +52,7 @@ const SheetContent = React.forwardRef<React.ElementRef<typeof DialogPrimitive.Co
|
|||||||
<DialogPrimitive.Content ref={ref} className={cn(sheetVariants({ side }), className)} {...props}>
|
<DialogPrimitive.Content ref={ref} className={cn(sheetVariants({ side }), className)} {...props}>
|
||||||
{children}
|
{children}
|
||||||
{showClose && (
|
{showClose && (
|
||||||
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none cursor-pointer">
|
<DialogPrimitive.Close className="absolute right-4 top-4 inline-flex size-7 items-center justify-center rounded-md opacity-70 transition-opacity hover:opacity-100 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/40 cursor-pointer">
|
||||||
<X className="size-4" />
|
<X className="size-4" />
|
||||||
<span className="sr-only">Close</span>
|
<span className="sr-only">Close</span>
|
||||||
</DialogPrimitive.Close>
|
</DialogPrimitive.Close>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export function ToggleSwitch({ value, onChange, ariaLabel, disabled }: ToggleSwi
|
|||||||
onClick={() => onChange(!value)}
|
onClick={() => onChange(!value)}
|
||||||
className={cn(
|
className={cn(
|
||||||
'relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors',
|
'relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors',
|
||||||
|
'outline-none focus-visible:ring-[3px] focus-visible:ring-ring/40',
|
||||||
disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer',
|
disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer',
|
||||||
// Off-track is a neutral foreground tint so it stays visible on any
|
// Off-track is a neutral foreground tint so it stays visible on any
|
||||||
// surface — including OLED pure-black (where bg-muted vanished).
|
// surface — including OLED pure-black (where bg-muted vanished).
|
||||||
|
|||||||
Reference in new issue
Block a user