From 6d4e8538ea8ff81fe2774828e1b0463d9d7c5d98 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Tue, 16 Jun 2026 14:10:04 +0800 Subject: [PATCH] fix(ui): add focus-visible ring to ToggleSwitch and Sheet close (B1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- packages/ui/src/components/sheet.tsx | 2 +- packages/webui/src/components/ui/toggle-switch.tsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/components/sheet.tsx b/packages/ui/src/components/sheet.tsx index 9f4a8406..5cd5eec0 100644 --- a/packages/ui/src/components/sheet.tsx +++ b/packages/ui/src/components/sheet.tsx @@ -52,7 +52,7 @@ const SheetContent = React.forwardRef {children} {showClose && ( - + Close diff --git a/packages/webui/src/components/ui/toggle-switch.tsx b/packages/webui/src/components/ui/toggle-switch.tsx index 78f854c6..dc92fb2b 100644 --- a/packages/webui/src/components/ui/toggle-switch.tsx +++ b/packages/webui/src/components/ui/toggle-switch.tsx @@ -21,6 +21,7 @@ export function ToggleSwitch({ value, onChange, ariaLabel, disabled }: ToggleSwi onClick={() => onChange(!value)} className={cn( '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', // Off-track is a neutral foreground tint so it stays visible on any // surface — including OLED pure-black (where bg-muted vanished).