diff --git a/src/renderer/src/assets/main.css b/src/renderer/src/assets/main.css index f5412aa291f..dfacef69961 100644 --- a/src/renderer/src/assets/main.css +++ b/src/renderer/src/assets/main.css @@ -90,6 +90,7 @@ --color-border: var(--border); --color-input: var(--input); --color-ring: var(--ring); + --color-focus-ring: var(--focus-ring); --color-editor-surface: var(--editor-surface); --color-floating-surface: var(--floating-surface); --color-dialog-surface: var(--dialog-surface); @@ -249,6 +250,9 @@ --border: #e5e5e5; --input: #e5e5e5; --ring: #a1a1a1; + /* Keyboard focus indicator, derived from the theme so plugin themes keep >=3:1 against + background, card, muted and accent (WCAG 2.2 focus appearance). */ + --focus-ring: color-mix(in oklab, var(--foreground) 55%, var(--background)); --terminal-pane-locate: var(--color-blue-600); --ai-action-accent: var(--color-violet-500); /* Use one question hue across surfaces, distinct from working-yellow. */ @@ -370,6 +374,7 @@ --border: rgb(255 255 255 / 0.07); --input: rgb(255 255 255 / 0.15); --ring: #737373; + --focus-ring: color-mix(in oklab, var(--foreground) 65%, var(--background)); --terminal-pane-locate: var(--color-blue-400); --ai-action-accent: var(--color-violet-400); --agent-question: var(--color-orange-500); @@ -524,6 +529,8 @@ --border: var(--orca-security-border); --input: var(--orca-security-input); --ring: var(--orca-security-ring); + /* Custom properties resolve where declared, so the trust chrome re-derives from its own colors. */ + --focus-ring: color-mix(in oklab, var(--foreground) 60%, var(--background)); /* A plugin theme copies its --popover into these, so trust dialogs would paint on it. */ --floating-surface: var(--orca-security-floating-surface); --dialog-surface: var(--orca-security-dialog-surface); @@ -763,7 +770,23 @@ body[data-modal-overlay-open] *, *::before, *::after { - @apply border-border outline-ring/50; + @apply border-border outline-focus-ring; + } + + /* Why: a safety net for components without their own motion-reduce variant. Layered !important + beats unlayered rules, so this wins. Spinners, pulses and [data-motion-essential] loaders keep + running because a frozen loader reads as a hang. */ + @media (prefers-reduced-motion: reduce) { + *:not(.animate-spin, .animate-pulse, [data-motion-essential], [data-motion-essential] *), + *:not([data-motion-essential], [data-motion-essential] *)::before, + *:not([data-motion-essential], [data-motion-essential] *)::after { + animation-duration: 0.01ms !important; + animation-delay: -0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + transition-delay: 0s !important; + scroll-behavior: auto !important; + } } body { @@ -3875,3 +3898,9 @@ body:has([data-contextual-tour-target='tab-create-menu'][data-state='open']) animation: none; } } + +/* Why: controls draw focus as an offset outline; call sites that opted into an inset ring sit + against clipping edges, so their outline moves inside the control instead of being cut off. */ +.focus-visible\:ring-inset.focus-visible\:ring-inset:focus-visible { + outline-offset: -2px; +} diff --git a/src/renderer/src/components/billing/plans/PlansIntervalToggle.tsx b/src/renderer/src/components/billing/plans/PlansIntervalToggle.tsx index 553f601513f..8193a2ff311 100644 --- a/src/renderer/src/components/billing/plans/PlansIntervalToggle.tsx +++ b/src/renderer/src/components/billing/plans/PlansIntervalToggle.tsx @@ -50,7 +50,7 @@ export function PlansIntervalToggle({ aria-pressed={value === option.interval} onClick={() => onChange(option.interval)} className={cn( - 'relative z-10 flex items-center justify-center gap-1.5 rounded-full px-4 py-1 text-xs font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:opacity-60', + 'relative z-10 flex items-center justify-center gap-1.5 rounded-full px-4 py-1 text-xs font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-focus-ring disabled:opacity-60', value === option.interval ? 'text-foreground' : 'text-muted-foreground hover:text-foreground' diff --git a/src/renderer/src/components/ui/accordion.tsx b/src/renderer/src/components/ui/accordion.tsx index 993b40010fa..ff8954cd68a 100644 --- a/src/renderer/src/components/ui/accordion.tsx +++ b/src/renderer/src/components/ui/accordion.tsx @@ -36,7 +36,7 @@ function AccordionTrigger({ svg]:rotate-180', + 'flex flex-1 items-center justify-between gap-2 py-2 text-left text-sm font-medium outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-focus-ring disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180', className )} {...props} diff --git a/src/renderer/src/components/ui/badge.tsx b/src/renderer/src/components/ui/badge.tsx index b2c5921aa10..46948686335 100644 --- a/src/renderer/src/components/ui/badge.tsx +++ b/src/renderer/src/components/ui/badge.tsx @@ -5,7 +5,7 @@ import * as Slot from 'radix-ui/slot' import { cn } from '@/lib/utils' const badgeVariants = cva( - 'inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3', + 'inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-2 focus-visible:outline-focus-ring aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3', { variants: { variant: { diff --git a/src/renderer/src/components/ui/button.tsx b/src/renderer/src/components/ui/button.tsx index 4e5693282b7..9f6483872f7 100644 --- a/src/renderer/src/components/ui/button.tsx +++ b/src/renderer/src/components/ui/button.tsx @@ -7,17 +7,19 @@ import { cn } from '@/lib/utils' const outlineButtonClasses = 'border border-border bg-background text-foreground shadow-xs hover:border-muted-foreground/35 hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50' +// A slight press on the solid and outlined buttons; motion-safe so reduced motion keeps them still. +const pressClasses = 'motion-safe:active:scale-[0.98]' + const buttonVariants = cva( - "inline-flex shrink-0 items-center justify-center gap-2 rounded-md cursor-pointer text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + "inline-flex shrink-0 items-center justify-center gap-2 rounded-md cursor-pointer text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-2 focus-visible:outline-focus-ring disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", { variants: { variant: { - default: 'bg-primary text-primary-foreground hover:bg-primary/90', - destructive: - 'bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40', - outline: outlineButtonClasses, + default: `bg-primary text-primary-foreground hover:bg-primary/90 ${pressClasses}`, + destructive: `bg-destructive text-white hover:bg-destructive/90 ${pressClasses} dark:bg-destructive/60`, + outline: `${outlineButtonClasses} ${pressClasses}`, 'orchestration-tab': `${outlineButtonClasses} border-(--crew-border) bg-(--crew-surface) text-card-foreground shadow-floating dark:border-(--crew-border) dark:bg-(--crew-surface) dark:hover:bg-accent dark:hover:text-accent-foreground`, - secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80', + secondary: `bg-secondary text-secondary-foreground hover:bg-secondary/80 ${pressClasses}`, ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50', link: 'text-primary underline-offset-4 hover:underline', 'menu-launch': diff --git a/src/renderer/src/components/ui/checkbox.tsx b/src/renderer/src/components/ui/checkbox.tsx index 612c03ebdf4..e4b0301f9dd 100644 --- a/src/renderer/src/components/ui/checkbox.tsx +++ b/src/renderer/src/components/ui/checkbox.tsx @@ -16,7 +16,7 @@ function Checkbox({ data-slot="checkbox" checked={checked} className={cn( - 'peer size-4 shrink-0 rounded-[4px] border border-input bg-background shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground dark:data-[state=unchecked]:border-muted-foreground/60', + 'peer size-4 shrink-0 rounded-[4px] border border-input bg-background shadow-xs outline-none transition-shadow focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-2 focus-visible:outline-focus-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground dark:data-[state=unchecked]:border-muted-foreground/60', className )} {...props} diff --git a/src/renderer/src/components/ui/collapsible.tsx b/src/renderer/src/components/ui/collapsible.tsx index fbd5f1d7794..4a2a570913e 100644 --- a/src/renderer/src/components/ui/collapsible.tsx +++ b/src/renderer/src/components/ui/collapsible.tsx @@ -15,7 +15,7 @@ const collapsibleTriggerVariants = cva('', { variants: { variant: { default: '', - row: 'group flex w-full cursor-pointer items-center justify-between gap-4 rounded-md bg-transparent py-2 text-left text-sm font-medium outline-none hover:bg-accent hover:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 dark:hover:bg-accent/50' + row: 'group flex w-full cursor-pointer items-center justify-between gap-4 rounded-md bg-transparent py-2 text-left text-sm font-medium outline-none hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-focus-ring dark:hover:bg-accent/50' } }, defaultVariants: { variant: 'default' } diff --git a/src/renderer/src/components/ui/input.tsx b/src/renderer/src/components/ui/input.tsx index fc0e0a5496c..1293a09df4b 100644 --- a/src/renderer/src/components/ui/input.tsx +++ b/src/renderer/src/components/ui/input.tsx @@ -39,7 +39,7 @@ const Input = React.forwardRef< data-slot="input" className={cn( 'h-9 w-full min-w-0 appearance-none rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30', - 'focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50', + 'focus-visible:border-focus-ring focus-visible:ring-1 focus-visible:ring-focus-ring', 'aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40', inputVariants({ variant, surface, density, adornment }), className diff --git a/src/renderer/src/components/ui/scroll-area.tsx b/src/renderer/src/components/ui/scroll-area.tsx index 6017b861062..e4e2645d36a 100644 --- a/src/renderer/src/components/ui/scroll-area.tsx +++ b/src/renderer/src/components/ui/scroll-area.tsx @@ -29,7 +29,7 @@ function ScrollArea({ tabIndex={viewportTabIndex} data-slot="scroll-area-viewport" className={cn( - 'size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1', + 'size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-2 focus-visible:ring-focus-ring', viewportClassName )} {...viewportProps} diff --git a/src/renderer/src/components/ui/select.tsx b/src/renderer/src/components/ui/select.tsx index 196027547d2..2e3280bab27 100644 --- a/src/renderer/src/components/ui/select.tsx +++ b/src/renderer/src/components/ui/select.tsx @@ -56,7 +56,7 @@ function SelectTrigger({ data-slot="select-trigger" data-size={size} className={cn( - "flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground", + "flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-focus-ring focus-visible:ring-1 focus-visible:ring-focus-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground", selectTriggerVariants({ density }), className )} diff --git a/src/renderer/src/components/ui/switch.tsx b/src/renderer/src/components/ui/switch.tsx index fdf1a31666f..c5eff55df1b 100644 --- a/src/renderer/src/components/ui/switch.tsx +++ b/src/renderer/src/components/ui/switch.tsx @@ -20,7 +20,7 @@ function Switch({ className, thumbClassName: thumbClasses, ...props }: SwitchPro data-slot="switch" className={cn( trackClassName, - 'cursor-pointer outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50', + 'cursor-pointer outline-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-2 focus-visible:outline-focus-ring disabled:cursor-not-allowed disabled:opacity-50', className )} {...props} diff --git a/src/renderer/src/components/ui/tabs.tsx b/src/renderer/src/components/ui/tabs.tsx index 2e4b8372636..9547930591b 100644 --- a/src/renderer/src/components/ui/tabs.tsx +++ b/src/renderer/src/components/ui/tabs.tsx @@ -64,7 +64,7 @@ function TabsTrigger({ className, ...props }: React.ComponentProps