Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore(ui): refine shared controls and floating surfaces
johnnyjoyghc640884067f2
diff --git a/web/src/components/AppSidebar/QuickFindDialog.tsx b/web/src/components/AppSidebar/QuickFindDialog.tsxindex 16c21eba5..48255ebb7 100644--- a/web/src/components/AppSidebar/QuickFindDialog.tsx+++ b/web/src/components/AppSidebar/QuickFindDialog.tsx@@ -4,7 +4,7 @@ import { useLocation, useNavigate } from "react-router-dom";import { Button } from "@/components/ui/button";import { Dialog, DialogContent, DialogDescription, DialogTitle } from "@/components/ui/dialog";import { Input } from "@/components/ui/input";-import { tabsTriggerVariants } from "@/components/ui/tabs";+import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";import { Textarea } from "@/components/ui/textarea";import { useAppSidebar } from "@/contexts/AppSidebarContext";import { getFilterSearch, isSearchFilter, type MemoFilter, useMemoFilterContext } from "@/contexts/MemoFilterContext";@@ -13,7 +13,6 @@ import useCurrentUser from "@/hooks/useCurrentUser";import { useMemoViews } from "@/hooks/useUserQueries";import { getMemoViewId, isMemoCollectionRoute } from "@/lib/memo-views";import { extractSpaceUidFromName, formatSpaceUidForDisplay } from "@/lib/space-display";-import { cn } from "@/lib/utils";import { getCollectionCreator, withCollectionCreator } from "@/router/routes";import { useTranslate } from "@/utils/i18n";import { getRouteActionPolicy, getSidebarRouteKind } from "./routes";@@ -89,6 +88,7 @@ const QuickFindDialog = () => {const { quickFindOpen, setQuickFindOpen } = useAppSidebar();const [query, setQuery] = useState("");const [mode, setMode] = useState<QuickFindMode>("text");+ const [autoFocusField, setAutoFocusField] = useState(true);const hintId = useId();const viewApplies = isMemoCollectionRoute(location.pathname);const selectedMemoView = viewApplies ? memoViews.find((item) => getMemoViewId(item.name) === memoView) : undefined;@@ -107,6 +107,7 @@ const QuickFindDialog = () => {useEffect(() => {if (!quickFindOpen) return;+ setAutoFocusField(true);const active = readQuickFindQuery(filters);setMode(active.mode);setQuery(active.query);@@ -140,7 +141,7 @@ const QuickFindDialog = () => {};const fieldProps = {- autoFocus: true,+ autoFocus: autoFocusField,value: query,onChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => setQuery(event.target.value),onKeyDown: handleKeyDown,@@ -150,6 +151,7 @@ const QuickFindDialog = () => {<Dialog open={quickFindOpen} onOpenChange={setQuickFindOpen}><DialogContentsize="lg"+ backdrop="subtle"className="top-[12vh]! translate-y-0! overflow-hidden border-border/70 p-0! shadow-xl sm:top-[16vh]! [&>div:first-child]:gap-0!"showCloseButton={false}>@@ -162,20 +164,20 @@ const QuickFindDialog = () => {<span className="min-w-0 truncate text-xs text-muted-foreground" title={scopeLabel}>{compactScopeLabel}</span>- <div role="tablist" aria-label={t("search.mode")} className="flex shrink-0 items-center gap-0.5 rounded-md bg-muted/60 p-0.5">- {(["text", "cel"] as const).map((value) => (- <button- key={value}- type="button"- role="tab"- aria-selected={mode === value}- onClick={() => setMode(value)}- className={cn(tabsTriggerVariants({ variant: "segmented", active: mode === value }), "h-6 px-2 py-0 text-xs")}- >- {value === "cel" ? t("search.expression-mode") : t("search.text")}- </button>- ))}- </div>+ <Tabs value={mode} onValueChange={(value) => setMode(value as QuickFindMode)} size="sm" className="shrink-0">+ <TabsList+ aria-label={t("search.mode")}+ // Arrow navigation keeps focus on the tabs; clicking a mode focuses its field.+ onKeyDownCapture={() => setAutoFocusField(false)}+ onClickCapture={() => setAutoFocusField(true)}+ >+ {(["text", "cel"] as const).map((value) => (+ <TabsTrigger key={value} value={value}>+ {value === "cel" ? t("search.expression-mode") : t("search.text")}+ </TabsTrigger>+ ))}+ </TabsList>+ </Tabs></div>{mode === "cel" ? (<div className="space-y-3 p-4">@@ -209,17 +211,11 @@ const QuickFindDialog = () => {<SearchIcon className="size-[17px] shrink-0 text-muted-foreground" strokeWidth={1.8} /><Input{...fieldProps}- className="h-10 border-0 bg-transparent px-0 !text-[14px] shadow-none focus-visible:ring-0"+ className="h-10 border-0 bg-transparent px-0 !text-[14px] focus-visible:outline-offset-2"placeholder={`${t("common.search")} ${compactScopeLabel}`}aria-label={`${t("common.search")} ${scopeLabel}`}/>- <Button- type="submit"- variant="ghost"- size="icon-sm"- className="size-7 shrink-0 rounded-md text-muted-foreground"- aria-label={t("common.search")}- >+ <Button type="submit" variant="quiet" size="icon-compact" aria-label={t("common.search")}><CornerDownLeftIcon className="size-3.5" /></Button></div>diff --git a/web/src/components/CustomIconPicker.tsx b/web/src/components/CustomIconPicker.tsxindex 3f702a193..8c011a37c 100644--- a/web/src/components/CustomIconPicker.tsx+++ b/web/src/components/CustomIconPicker.tsx@@ -98,25 +98,10 @@ function CustomIconPicker({ value, onChange, disabled, label, fallback = Astroid<CustomIcon icon={value} fallback={fallback} className="size-5 text-xl" /></PopoverTrigger><PopoverContent align="start" className="w-[290px] max-w-[calc(100vw-2rem)] p-2" aria-label={label} initialFocus={searchRef}>- <Tabs value={tab} onValueChange={changeTab}>- <TabsList className="mb-2 rounded-md bg-muted/60 p-0.5" aria-label={t("space.icon.kind")}>+ <Tabs value={tab} onValueChange={changeTab} size="sm">+ <TabsList className="mb-2" aria-label={t("space.icon.kind")}>{(["icons", "emoji"] as const).map((name) => (- <TabsTrigger- key={name}- id={`${id}-${name}`}- value={name}- aria-controls={`${id}-panel`}- tabIndex={tab === name ? 0 : -1}- className="flex-1 py-1 text-xs"- onKeyDown={(event) => {- if (event.key === "ArrowLeft" || event.key === "ArrowRight") {- event.preventDefault();- const next = name === "icons" ? "emoji" : "icons";- changeTab(next);- document.getElementById(`${id}-${next}`)?.focus();- }- }}- >+ <TabsTrigger key={name} id={`${id}-${name}`} value={name} aria-controls={`${id}-panel`} className="flex-1">{t(`space.icon.${name}`)}</TabsTrigger>))}diff --git a/web/src/components/MemoEditor/edit/editor.css b/web/src/components/MemoEditor/edit/editor.cssindex 169667cd3..e4ef3735c 100644--- a/web/src/components/MemoEditor/edit/editor.css+++ b/web/src/components/MemoEditor/edit/editor.css@@ -1,7 +1,9 @@+@reference "../../../index.css";+/** Composer layout around @usememos/editor. Colors, fonts and block rhythm come* from MEMO_EDITOR_THEME (lib/memo-markdown.ts); this file only sizes the- * editor in the composer and styles the upload anchors it hosts as widgets.+ * editor in the composer, aligns its floating UI with the app, and styles upload widgets.*/.memo-editor-content {& .memo-editor-scroller {@@ -119,3 +121,17 @@animation: none;}}++/* The editor portals its own UI outside the composer. Match the app's floating+ surfaces here without changing document typography or package internals. */+.mbe-ui:is(.mbe-menu, .mbe-toolbar, .mbe-image-toolbar, .mbe-link-card, .mbe-input-popover) {+ @apply rounded-lg border-border/70 bg-popover text-popover-foreground text-ui font-normal leading-5 tracking-normal shadow-float;+}++.mbe-ui.mbe-menu {+ @apply p-1.5;+}++.mbe-ui.mbe-tooltip {+ @apply max-w-[min(16rem,calc(100vw-1rem))] whitespace-normal rounded-md border border-border/70 bg-popover px-2 py-1 text-xs font-normal leading-4 tracking-normal text-popover-foreground text-pretty [overflow-wrap:anywhere] shadow-md;+}diff --git a/web/src/components/Settings/LinkedIdentitySection.tsx b/web/src/components/Settings/LinkedIdentitySection.tsxindex 7c5f21295..0fc6a4b79 100644--- a/web/src/components/Settings/LinkedIdentitySection.tsx+++ b/web/src/components/Settings/LinkedIdentitySection.tsx@@ -152,7 +152,7 @@ const LinkedIdentitySection = () => {<div className="flex min-w-[16rem] flex-col gap-2"><div className="flex flex-wrap items-center gap-2"><span className="text-sm font-medium text-foreground">{row.title}</span>- <Badge variant="secondary" className="rounded-full px-2.5 py-0.5">+ <Badge variant="neutral" shape="pill">{row.typeLabel}</Badge></div>@@ -168,7 +168,7 @@ const LinkedIdentitySection = () => {render: (_, row: LinkedIdentityRow) => (<div className="flex min-w-[22rem] flex-col gap-2"><div className="flex flex-wrap items-center gap-2">- <Badge variant={row.isLinked ? "default" : "outline"} className="rounded-full px-2.5 py-0.5">+ <Badge variant={row.isLinked ? "neutral" : "outline"} shape="pill">{row.isLinked ? t("setting.sso.linked") : t("setting.sso.not-linked")}</Badge>{row.isLinked && row.externalUid ? (diff --git a/web/src/components/Settings/MemberSection.tsx b/web/src/components/Settings/MemberSection.tsxindex 4b41d90fb..95030ba31 100644--- a/web/src/components/Settings/MemberSection.tsx+++ b/web/src/components/Settings/MemberSection.tsx@@ -146,10 +146,10 @@ const MemberSection = () => {render: (_, user: User) => (<div className="flex min-w-[18rem] flex-col gap-2"><div className="flex flex-wrap items-center gap-2">- <Badge variant="secondary" className="rounded-full px-2.5 py-0.5">+ <Badge variant="neutral" shape="pill">{stringifyUserRole(user.role)}</Badge>- <Badge variant={user.state === State.ARCHIVED ? "outline" : "default"} className="rounded-full px-2.5 py-0.5">+ <Badge variant={user.state === State.ARCHIVED ? "outline" : "neutral"} shape="pill">{user.state === State.ARCHIVED ? t("setting.member.archived") : t("setting.member.active")}</Badge></div>diff --git a/web/src/components/ui/README.md b/web/src/components/ui/README.mdindex 44963e6a8..64251f54a 100644--- a/web/src/components/ui/README.md+++ b/web/src/components/ui/README.md@@ -1,6 +1,6 @@# UI Kit (`components/ui`)-shadcn/ui primitives ("new-york" style, zinc base, lucide icons, CSS variables).+Base UI primitives with local styling, Lucide icons, and semantic CSS variables.This folder is the **single source of styling truth**. Read this before adding acomponent or reaching for `className` on a kit component.@@ -24,17 +24,25 @@ Color comes from the semantic OKLCH tokens documented in| Component | variant | size / shape | Notes || --- | --- | --- | --- |-| **Button** | default · destructive · outline · secondary · ghost · link · **quiet** | size: default · sm · lg · icon · **icon-compact** · **icon-sm** | Every variant carries the kit's ring-free keyboard focus (`FOCUS_VISIBLE_OUTLINE_CLASSES` from `ui/focus.ts`; raw controls import the same constant). `quiet` is local: 13px muted ink that darkens under a `bg-muted/60` hover wash, and the accent fill only for `aria-pressed`, `aria-current` or `data-popup-open`. Use it via `buttonVariants({ variant: "quiet" })` on raw `<button>`/`<a>` elements too (calendar controls, memo outline, card actions). `icon-compact` (`size-7`) is the 28px square matching `sm`'s height; `icon-sm` (`size-6`) is for dense icon buttons. Auto-sizes unsized `svg` children to `size-4`. |-| **Badge** | default · secondary · destructive · outline · **warning** | shape: default · **pill** | `warning` + `shape` are local additions. `pill` = `rounded-full`. |-| **Tabs** | — | variant: **segmented** · **underline** | Local component (not upstream shadcn). Context-based `Tabs`/`TabsList`/`TabsTrigger`, no Radix. `underline` relies on the consumer's own divider. |-| **Dialog** | — | size: sm · default · lg · xl · 2xl · full | Local `size` variants + auto-focus prevention on open. |-| **Select** | — | size: xs · sm · default | Local `size` prop on the trigger. |-| **DropdownMenu** | item: default · destructive | — | Local destructive item variant + a sub-menu hover-delay hook. |+| **Button** | default · destructive · outline · secondary · ghost · link · **quiet** | size: default · sm · lg · icon · **icon-compact** · **icon-sm** | Default buttons use 14px text; `sm` uses 13px text with a 6px icon gap. Outline, secondary, ghost, and quiet controls show their pressed/open state. Every variant carries the kit's ring-free keyboard focus (`FOCUS_VISIBLE_OUTLINE_CLASSES` from `ui/focus.ts`; raw controls import the same constant). `quiet` is local: 13px muted ink that darkens under a `bg-muted/60` hover wash, and the accent fill only for `aria-pressed`, `aria-current` or `data-popup-open`. Use it via `buttonVariants({ variant: "quiet" })` on raw `<button>`/`<a>` elements too (calendar controls, memo outline, card actions). `icon-compact` (`size-7`) is the 28px square matching `sm`'s height; `icon-sm` (`size-6`) is for dense icon buttons. Auto-sizes unsized `svg` children to `size-4`. |+| **Badge** | default · **neutral** · secondary · destructive · outline · **warning** | shape: default · **pill** | `neutral` is for ordinary metadata/status; retain semantic warning/destructive colors. Badges use 12px/16px text with a 20px minimum height. `pill` = `rounded-full`. |+| **Tabs** | segmented · underline | size: default · **sm** | Base UI handles roving focus, arrows, Home/End, disabled tabs, and RTL. Arrow focus activates tabs by default (`TabsList activateOnFocus={false}` opts out). `sm` is 28px/13px, default is 32px/14px. The list owns segmented padding/background; underline relies on the consumer's divider. |+| **Dialog** | — | size: sm · default · lg · xl · 2xl · full | `backdrop="subtle"` is for tool dialogs such as search; default keeps the stronger scrim. Content uses the popover surface, 12px radius, a 28px close target, and reduced-motion-aware transitions. Base UI manages focus. |+| **Select** | — | size: xs · sm · default | Default is 32px/14px, `sm` is 28px/13px, `xs` is 24px/12px. Open state, focus, and invalid styling match other form fields. |+| **DropdownMenu** | item: default · destructive | size: default · sm | Shared floating surface and motion; compact menus retain 28px rows. Base UI manages submenus. |Each cva component also exports its variant types, e.g. `ButtonVariant`,-`ButtonSize`, `BadgeVariant`, `BadgeShape`, `TabsVariant` — use these instead of+`ButtonSize`, `BadgeVariant`, `BadgeShape`, `TabsVariant`, `TabsSize` — use these instead ofre-deriving `VariantProps`.+## Control states++- Fields use `FIELD_FOCUS_CLASSES` from `focus.ts`: a visible keyboard outline, focused border, and semantic `aria-invalid` / Base UI `data-invalid` styling. Invalid color remains visible on hover and focus. Resting fields have no shadow; disabled fields have a muted surface.+- Checkbox, radio, and switch outlines sit 2px outside their small visual bounds. Give controls a label/row target rather than shrinking the clickable area to the glyph.+- Switch: 32×20px track, 16px thumb, 2px visual inset, 12px logical travel in either text direction.+- Buttons and fields keep typography appropriate to their role; mobile text inputs retain 16px text. Avoid substituting smaller text through per-screen overrides.+- Sheet transitions take 200ms. Dialog/sheet, tabs, buttons, and controls respect reduced motion.+## Layering (z-index tiers)Defined once as Tailwind tokens in `themes/default.css` (`--z-index-*`) and used@@ -44,7 +52,7 @@ by the primitives — do not hardcode `z-[60]`-style literals:| --- | --- | --- || `z-overlay` | 50 | Dialog / Sheet overlay + content || `z-dropdown` | 60 | Select / DropdownMenu / Popover content |-| `z-tooltip` | 70 | Tooltip content + arrow |+| `z-tooltip` | 70 | Tooltip content |A dropdown inside a dialog needs `z-dropdown` (already the default) so it rendersabove the overlay; a tooltip sits above everything.diff --git a/web/src/components/ui/badge.tsx b/web/src/components/ui/badge.tsxindex da42499f9..848b36056 100644--- a/web/src/components/ui/badge.tsx+++ b/web/src/components/ui/badge.tsx@@ -3,11 +3,12 @@ import * as React from "react";import { cn } from "@/lib/utils";const badgeVariants = cva(- "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none transition-[color,box-shadow] overflow-hidden",+ "inline-flex min-h-5 items-center justify-center rounded border px-1.5 py-px text-xs font-medium leading-4 w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none transition-colors duration-150 overflow-hidden motion-reduce:transition-none",{variants: {variant: {default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",+ neutral: "border-transparent bg-muted/60 text-foreground/80 [a&]:hover:bg-muted",secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive: "border-transparent bg-destructive text-destructive-foreground [a&]:hover:bg-destructive/90",outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",diff --git a/web/src/components/ui/button.tsx b/web/src/components/ui/button.tsxindex b69da66a7..49262d6e0 100644--- a/web/src/components/ui/button.tsx+++ b/web/src/components/ui/button.tsx@@ -6,17 +6,21 @@ import { FOCUS_VISIBLE_OUTLINE_CLASSES } from "./focus";const buttonVariants = cva(cn(- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0",+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,background-color,border-color,box-shadow] duration-150 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 motion-reduce:transition-none",FOCUS_VISIBLE_OUTLINE_CLASSES,),{variants: {variant: {- default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",+ default:+ "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90 data-popup-open:bg-primary/90 aria-pressed:bg-primary/90",destructive: "bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",- secondary: "bg-secondary text-secondary-foreground hover:shadow-xs hover:bg-secondary/80",- ghost: "hover:bg-accent hover:text-accent-foreground",+ outline:+ "border border-border/80 bg-transparent hover:bg-muted/60 hover:text-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground aria-pressed:bg-accent aria-pressed:text-accent-foreground",+ secondary:+ "bg-secondary text-secondary-foreground hover:bg-secondary/80 data-popup-open:bg-accent data-popup-open:text-accent-foreground aria-pressed:bg-accent aria-pressed:text-accent-foreground",+ ghost:+ "hover:bg-muted/60 hover:text-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground aria-pressed:bg-accent aria-pressed:text-accent-foreground",link: "text-primary underline-offset-4 hover:underline",// A quiet control in the spirit of Notion and Linear: 13px muted ink that darkens under// a light hover wash, and the accent fill reserved for the one state that is "on" —@@ -26,7 +30,7 @@ const buttonVariants = cva(},size: {default: "h-8 px-3",- sm: "h-7 rounded-md gap-1 px-2 has-[>svg]:px-2",+ sm: "h-7 gap-1.5 px-2 text-ui",lg: "h-9 rounded-md px-4",icon: "size-8",// The 28px square: the height of `sm`, and the sidebar's compose-control square.diff --git a/web/src/components/ui/checkbox.tsx b/web/src/components/ui/checkbox.tsxindex 21c757ee9..82cc494fb 100644--- a/web/src/components/ui/checkbox.tsx+++ b/web/src/components/ui/checkbox.tsx@@ -2,6 +2,7 @@ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";import { CheckIcon } from "lucide-react";import * as React from "react";import { cn } from "@/lib/utils";+import { FIELD_FOCUS_CLASSES } from "./focus";const Checkbox = React.forwardRef<HTMLSpanElement, CheckboxPrimitive.Root.Props>(({ className, ...props }, ref) => {return (@@ -9,7 +10,9 @@ const Checkbox = React.forwardRef<HTMLSpanElement, CheckboxPrimitive.Root.Props>ref={ref}data-slot="checkbox"className={cn(- "peer border-border data-checked:bg-primary data-checked:text-primary-foreground data-checked:border-primary size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow data-disabled:cursor-not-allowed data-disabled:opacity-50",+ "peer border-input data-checked:bg-primary data-checked:text-primary-foreground data-checked:border-primary size-4 shrink-0 rounded border transition-[color,background-color,border-color] duration-150 data-disabled:cursor-not-allowed data-disabled:opacity-50 motion-reduce:transition-none",+ FIELD_FOCUS_CLASSES,+ "focus-visible:outline-offset-2",className,)}{...props}diff --git a/web/src/components/ui/dialog.tsx b/web/src/components/ui/dialog.tsxindex c35b96ee8..edaa25bed 100644--- a/web/src/components/ui/dialog.tsx+++ b/web/src/components/ui/dialog.tsx@@ -3,6 +3,7 @@ import { cva, type VariantProps } from "class-variance-authority";import { XIcon } from "lucide-react";import * as React from "react";import { cn } from "@/lib/utils";+import { buttonVariants } from "./button";const Dialog = DialogPrimitive.Root;@@ -12,21 +13,26 @@ const DialogPortal = DialogPrimitive.Portal;const DialogClose = DialogPrimitive.Close;-const DialogOverlay = React.forwardRef<HTMLDivElement, DialogPrimitive.Backdrop.Props>(({ className, ...props }, ref) => (- <DialogPrimitive.Backdrop- ref={ref}- data-slot="dialog-overlay"- className={cn(- "fixed inset-0 z-overlay bg-overlay/50 transition-opacity duration-200 data-starting-style:opacity-0 data-ending-style:opacity-0",- className,- )}- {...props}- />-));+type DialogBackdrop = "default" | "subtle";++const DialogOverlay = React.forwardRef<HTMLDivElement, DialogPrimitive.Backdrop.Props & { tone?: DialogBackdrop }>(+ ({ className, tone = "default", ...props }, ref) => (+ <DialogPrimitive.Backdrop+ ref={ref}+ data-slot="dialog-overlay"+ className={cn(+ "fixed inset-0 z-overlay transition-opacity duration-150 data-starting-style:opacity-0 data-ending-style:opacity-0 motion-reduce:transition-none",+ tone === "subtle" ? "bg-overlay/35" : "bg-overlay/50",+ className,+ )}+ {...props}+ />+ ),+);DialogOverlay.displayName = "DialogOverlay";const dialogContentVariants = cva(- "bg-background fixed top-[50%] left-[50%] z-overlay flex max-h-[calc(100vh-2rem)] translate-x-[-50%] translate-y-[-50%] flex-col rounded-lg border shadow-lg transition-[opacity,scale] duration-200 data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0 sm:max-h-[calc(100vh-3rem)] md:max-h-[calc(100vh-4rem)]",+ "bg-popover text-popover-foreground fixed top-[50%] left-[50%] z-overlay flex max-h-[calc(100vh-2rem)] translate-x-[-50%] translate-y-[-50%] flex-col rounded-xl border border-border/70 shadow-float motion-safe:transition-[opacity,scale] motion-safe:duration-150 motion-safe:ease-out motion-safe:data-starting-style:scale-[0.98] motion-safe:data-starting-style:opacity-0 motion-safe:data-ending-style:scale-[0.98] motion-safe:data-ending-style:opacity-0 sm:max-h-[calc(100vh-3rem)] md:max-h-[calc(100vh-4rem)]",{variants: {size: {@@ -51,14 +57,15 @@ const DialogContent = React.forwardRef<DialogPrimitive.Popup.Props &VariantProps<typeof dialogContentVariants> & {showCloseButton?: boolean;+ backdrop?: DialogBackdrop;}->(({ className, children, showCloseButton = true, size, ...props }, ref) => (+>(({ className, children, showCloseButton = true, backdrop = "default", size, ...props }, ref) => (<DialogPortal>- <DialogOverlay />+ <DialogOverlay tone={backdrop} /><DialogPrimitive.Popup ref={ref} className={cn(dialogContentVariants({ size }), className)} {...props}><div className="overflow-y-auto overflow-x-hidden flex-1 flex flex-col gap-4">{children}</div>{showCloseButton && (- <DialogPrimitive.Close className="ring-offset-background absolute top-4 end-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4">+ <DialogPrimitive.Close className={cn(buttonVariants({ variant: "quiet", size: "icon-compact" }), "absolute top-3 end-3")}><XIcon /><span className="sr-only">Close</span></DialogPrimitive.Close>@@ -69,7 +76,7 @@ const DialogContent = React.forwardRef<DialogContent.displayName = "DialogContent";const DialogHeader = React.forwardRef<React.ElementRef<"div">, React.ComponentPropsWithoutRef<"div">>(({ className, ...props }, ref) => (- <div ref={ref} className={cn("flex flex-col gap-2 text-center sm:text-start", className)} {...props} />+ <div ref={ref} className={cn("flex flex-col gap-1.5 pe-8 text-start", className)} {...props} />));DialogHeader.displayName = "DialogHeader";@@ -79,12 +86,12 @@ const DialogFooter = React.forwardRef<React.ElementRef<"div">, React.ComponentPrDialogFooter.displayName = "DialogFooter";const DialogTitle = React.forwardRef<HTMLHeadingElement, DialogPrimitive.Title.Props>(({ className, ...props }, ref) => (- <DialogPrimitive.Title ref={ref} className={cn("text-lg leading-none font-semibold", className)} {...props} />+ <DialogPrimitive.Title ref={ref} className={cn("text-base leading-6 font-semibold", className)} {...props} />));DialogTitle.displayName = "DialogTitle";const DialogDescription = React.forwardRef<HTMLParagraphElement, DialogPrimitive.Description.Props>(({ className, ...props }, ref) => (- <DialogPrimitive.Description ref={ref} className={cn("text-muted-foreground text-sm", className)} {...props} />+ <DialogPrimitive.Description ref={ref} className={cn("text-muted-foreground text-sm leading-5", className)} {...props} />));DialogDescription.displayName = "DialogDescription";diff --git a/web/src/components/ui/dropdown-menu.tsx b/web/src/components/ui/dropdown-menu.tsxindex 9321f51cc..fc1e886b5 100644--- a/web/src/components/ui/dropdown-menu.tsx+++ b/web/src/components/ui/dropdown-menu.tsx@@ -2,7 +2,7 @@ import { Menu as DropdownMenuPrimitive } from "@base-ui/react/menu";import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";import * as React from "react";import { cn } from "@/lib/utils";-import { popupMotionClasses } from "./popup";+import { popupMotionClasses, popupSurfaceClasses } from "./popup";const DropdownMenu = ({ ...props }: DropdownMenuPrimitive.Root.Props) => {return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" modal={false} {...props} />;@@ -28,7 +28,7 @@ type DropdownMenuContentProps = DropdownMenuPrimitive.Popup.Props &};const DropdownMenuContent = React.forwardRef<HTMLDivElement, DropdownMenuContentProps>(- ({ className, align, alignOffset, collisionAvoidance, positionMethod, side, sideOffset = 4, size = "default", ...props }, ref) => {+ ({ className, align, alignOffset, collisionAvoidance, positionMethod, side, sideOffset = 6, size = "default", ...props }, ref) => {return (<DropdownMenuSizeContext.Provider value={size}><DropdownMenuPrimitive.Portal>@@ -46,8 +46,9 @@ const DropdownMenuContent = React.forwardRef<HTMLDivElement, DropdownMenuContentdata-slot="dropdown-menu-content"data-size={size}className={cn(- "bg-popover text-popover-foreground z-dropdown max-h-(--available-height) origin-(--transform-origin) overflow-x-hidden overflow-y-auto border outline-none",- size === "sm" ? "min-w-24 rounded p-0.5 shadow-sm" : "min-w-[8rem] rounded-md p-1 shadow-md",+ popupSurfaceClasses,+ "z-dropdown max-h-(--available-height) max-w-(--available-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none",+ size === "sm" ? "min-w-24 p-1" : "min-w-32 p-1.5",popupMotionClasses,className,)}@@ -67,10 +68,10 @@ function DropdownMenuGroup({ ...props }: DropdownMenuPrimitive.Group.Props) {const dropdownMenuItemClasses = (size: DropdownMenuSize) =>cn(- "data-highlighted:bg-accent data-highlighted:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:data-highlighted:bg-destructive/10 data-[variant=destructive]:data-highlighted:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center rounded-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",+ "data-highlighted:bg-accent data-highlighted:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:data-highlighted:bg-destructive/10 data-[variant=destructive]:data-highlighted:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center rounded outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",size === "sm"? "min-h-7 gap-1.5 px-2 py-1 text-ui data-[inset]:ps-7 [&_svg:not([class*='size-'])]:size-3.5"- : "gap-2 px-2 py-1.5 text-sm data-[inset]:ps-8 [&_svg:not([class*='size-'])]:size-4",+ : "min-h-8 gap-2 px-2 py-1.5 text-ui data-[inset]:ps-8 [&_svg:not([class*='size-'])]:size-4",);function DropdownMenuItem({@@ -126,10 +127,10 @@ function DropdownMenuCheckboxItem({<DropdownMenuPrimitive.CheckboxItemdata-slot="dropdown-menu-checkbox-item"className={cn(- "data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex cursor-default items-center rounded-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",+ "data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex cursor-default items-center rounded outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",size === "sm"? cn("min-h-7 gap-1.5 py-1 text-ui [&_svg:not([class*='size-'])]:size-3.5", trailing ? "ps-2 pe-7" : "pe-2 ps-7")- : cn("gap-2 py-1.5 text-sm [&_svg:not([class*='size-'])]:size-4", trailing ? "ps-2 pe-8" : "pe-2 ps-8"),+ : cn("min-h-8 gap-2 py-1.5 text-ui [&_svg:not([class*='size-'])]:size-4", trailing ? "ps-2 pe-8" : "pe-2 ps-8"),className,)}checked={checked}@@ -156,10 +157,10 @@ function DropdownMenuRadioItem({ className, children, ...props }: DropdownMenuPr<DropdownMenuPrimitive.RadioItemdata-slot="dropdown-menu-radio-item"className={cn(- "data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex cursor-default items-center rounded-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",+ "data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex cursor-default items-center rounded outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",size === "sm"? "min-h-7 gap-1.5 py-1 pe-2 ps-7 text-ui [&_svg:not([class*='size-'])]:size-3.5"- : "gap-2 py-1.5 pe-2 ps-8 text-sm [&_svg:not([class*='size-'])]:size-4",+ : "min-h-8 gap-2 py-1.5 pe-2 ps-8 text-ui [&_svg:not([class*='size-'])]:size-4",className,)}{...props}@@ -187,7 +188,11 @@ function DropdownMenuLabel({<DropdownMenuPrimitive.GroupLabeldata-slot="dropdown-menu-label"data-inset={inset}- className={cn("px-2 font-medium", size === "sm" ? "py-1 text-ui data-[inset]:ps-7" : "py-1.5 text-sm data-[inset]:ps-8", className)}+ className={cn(+ "px-2 text-xs font-medium leading-4 text-muted-foreground",+ size === "sm" ? "py-1 data-[inset]:ps-7" : "py-1.5 data-[inset]:ps-8",+ className,+ )}{...props}/>);@@ -199,7 +204,7 @@ function DropdownMenuSeparator({ className, ...props }: DropdownMenuPrimitive.Sereturn (<DropdownMenuPrimitive.Separatordata-slot="dropdown-menu-separator"- className={cn("bg-border h-px", size === "sm" ? "-mx-0.5 my-0.5" : "-mx-1 my-1", className)}+ className={cn("bg-border/60 h-px", size === "sm" ? "-mx-1 my-1" : "-mx-1.5 my-1.5", className)}{...props}/>);@@ -211,7 +216,7 @@ function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"spareturn (<spandata-slot="dropdown-menu-shortcut"- className={cn("text-muted-foreground ms-auto tracking-widest", size === "sm" ? "text-2xs" : "text-xs", className)}+ className={cn("text-muted-foreground ms-auto ps-4 font-normal tracking-normal", size === "sm" ? "text-2xs" : "text-xs", className)}{...props}/>);@@ -236,10 +241,10 @@ function DropdownMenuSubTrigger({data-slot="dropdown-menu-sub-trigger"data-inset={inset}className={cn(- "data-highlighted:bg-accent data-highlighted:text-accent-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center rounded-sm outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0",+ "data-highlighted:bg-accent data-highlighted:text-accent-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center rounded outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0",size === "sm"? "min-h-7 gap-1.5 px-2 py-1 text-ui data-[inset]:ps-7 [&_svg:not([class*='size-'])]:size-3.5"- : "gap-2 px-2 py-1.5 text-sm data-[inset]:ps-8 [&_svg:not([class*='size-'])]:size-4",+ : "min-h-8 gap-2 px-2 py-1.5 text-ui data-[inset]:ps-8 [&_svg:not([class*='size-'])]:size-4",className,)}{...props}diff --git a/web/src/components/ui/focus.ts b/web/src/components/ui/focus.tsindex b35dcce2b..f3046562f 100644--- a/web/src/components/ui/focus.ts+++ b/web/src/components/ui/focus.ts@@ -1,8 +1,11 @@/*** The kit's one focus treatment: a 2px inset outline in the ring color, drawn only for* keyboard focus. Outline, not `ring-*`, so it never adds to the box or reads as a border.- * Kit buttons carry it from their base; raw elements that act as controls (calendar grid- * cells, the reaction chip) take it from here.+ * Kit buttons carry it from their base; raw controls take it from here. Small+ * checkboxes, radios, and switches move the outline outside their visual bounds.*/export const FOCUS_VISIBLE_OUTLINE_CLASSES ="focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring/60";++/** Form fields keep validation visible while sharing the kit's keyboard outline. */+export const FIELD_FOCUS_CLASSES = `${FOCUS_VISIBLE_OUTLINE_CLASSES} focus-visible:border-ring aria-invalid:border-destructive aria-invalid:hover:border-destructive aria-invalid:focus-visible:outline-destructive data-invalid:border-destructive data-invalid:hover:border-destructive data-invalid:focus-visible:outline-destructive`;diff --git a/web/src/components/ui/input.tsx b/web/src/components/ui/input.tsxindex 213297a85..589df4ded 100644--- a/web/src/components/ui/input.tsx+++ b/web/src/components/ui/input.tsx@@ -1,5 +1,6 @@import * as React from "react";import { cn } from "@/lib/utils";+import { FIELD_FOCUS_CLASSES } from "./focus";function Input({ className, type, ...props }: React.ComponentProps<"input">) {return (@@ -7,7 +8,8 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {type={type}data-slot="input"className={cn(- "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground border-border flex h-8 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground border-border/80 flex h-8 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base transition-[color,border-color,background-color] duration-150 hover:not-disabled:border-input file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted/50 disabled:opacity-50 md:text-sm motion-reduce:transition-none",+ FIELD_FOCUS_CLASSES,className,)}{...props}diff --git a/web/src/components/ui/popover.tsx b/web/src/components/ui/popover.tsxindex 1c23f8d32..a6c62ce7f 100644--- a/web/src/components/ui/popover.tsx+++ b/web/src/components/ui/popover.tsx@@ -1,7 +1,7 @@import { Popover as PopoverPrimitive } from "@base-ui/react/popover";import * as React from "react";import { cn } from "@/lib/utils";-import { popupMotionClasses } from "./popup";+import { popupMotionClasses, popupSurfaceClasses } from "./popup";const Popover = ({ ...props }: PopoverPrimitive.Root.Props) => {return <PopoverPrimitive.Root data-slot="popover" {...props} />;@@ -16,7 +16,7 @@ const PopoverContent = React.forwardRef<HTMLDivElement,PopoverPrimitive.Popup.Props &Pick<PopoverPrimitive.Positioner.Props, "anchor" | "align" | "alignOffset" | "positionMethod" | "side" | "sideOffset">->(({ className, anchor, align = "center", alignOffset, positionMethod, side, sideOffset = 4, ...props }, ref) => {+>(({ className, anchor, align = "center", alignOffset, positionMethod, side, sideOffset = 6, ...props }, ref) => {return (<PopoverPrimitive.Portal><PopoverPrimitive.Positioner@@ -32,7 +32,8 @@ const PopoverContent = React.forwardRef<ref={ref}data-slot="popover-content"className={cn(- "bg-popover text-popover-foreground z-dropdown w-auto origin-(--transform-origin) rounded-md border p-1 shadow-md outline-hidden",+ popupSurfaceClasses,+ "z-dropdown w-auto max-w-(--available-width) origin-(--transform-origin) p-1.5 outline-hidden",popupMotionClasses,className,)}diff --git a/web/src/components/ui/popup.ts b/web/src/components/ui/popup.tsindex 1e234d650..d66e9854c 100644--- a/web/src/components/ui/popup.ts+++ b/web/src/components/ui/popup.ts@@ -1,11 +1,15 @@// Shared enter/exit motion for popup surfaces (dropdown menu, popover, tooltip), driven by// Base UI's data-starting-style/data-ending-style attributes. Keep in one place so all-// popups animate identically; select.tsx uses a closer-range variant of the same pattern.+// popups animate consistently and respect reduced-motion preferences.//// Layout note for consumers: while a popup is open, Base UI inserts focus-guard spans as// siblings of the trigger. They are fixed-position and take no space, but they do make the// trigger stop being `:last-child` — so a `space-y-*` parent starts applying its margin to it// and everything below shifts (#6154). Space a stack that contains a popup trigger with// `flex flex-col gap-*`, which ignores out-of-flow children.+// Neutral surfaces share the theme's popover pair; primary is reserved for actions.+export const popupSurfaceClasses =+ "bg-popover text-popover-foreground rounded-lg border border-border/70 shadow-float text-ui font-normal leading-5 tracking-normal";+export const popupMotionClasses =- "transition-[opacity,scale,translate] duration-150 data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0 data-[side=bottom]:data-starting-style:-translate-y-2 data-[side=bottom]:data-ending-style:-translate-y-2 data-[side=left]:data-starting-style:translate-x-2 data-[side=left]:data-ending-style:translate-x-2 data-[side=right]:data-starting-style:-translate-x-2 data-[side=right]:data-ending-style:-translate-x-2 data-[side=inline-start]:data-starting-style:translate-x-2 data-[side=inline-start]:data-ending-style:translate-x-2 rtl:data-[side=inline-start]:data-starting-style:-translate-x-2 rtl:data-[side=inline-start]:data-ending-style:-translate-x-2 data-[side=inline-end]:data-starting-style:-translate-x-2 data-[side=inline-end]:data-ending-style:-translate-x-2 rtl:data-[side=inline-end]:data-starting-style:translate-x-2 rtl:data-[side=inline-end]:data-ending-style:translate-x-2 data-[side=top]:data-starting-style:translate-y-2 data-[side=top]:data-ending-style:translate-y-2";+ "transition-[opacity,scale,translate] duration-150 ease-out data-starting-style:scale-[0.98] data-starting-style:opacity-0 data-ending-style:scale-[0.98] data-ending-style:opacity-0 data-[side=bottom]:data-starting-style:-translate-y-1 data-[side=bottom]:data-ending-style:-translate-y-1 data-[side=left]:data-starting-style:translate-x-1 data-[side=left]:data-ending-style:translate-x-1 data-[side=right]:data-starting-style:-translate-x-1 data-[side=right]:data-ending-style:-translate-x-1 data-[side=inline-start]:data-starting-style:translate-x-1 data-[side=inline-start]:data-ending-style:translate-x-1 rtl:data-[side=inline-start]:data-starting-style:-translate-x-1 rtl:data-[side=inline-start]:data-ending-style:-translate-x-1 data-[side=inline-end]:data-starting-style:-translate-x-1 data-[side=inline-end]:data-ending-style:-translate-x-1 rtl:data-[side=inline-end]:data-starting-style:translate-x-1 rtl:data-[side=inline-end]:data-ending-style:translate-x-1 data-[side=top]:data-starting-style:translate-y-1 data-[side=top]:data-ending-style:translate-y-1 motion-reduce:transition-none motion-reduce:transform-none motion-reduce:translate-none motion-reduce:scale-100";diff --git a/web/src/components/ui/radio-group.tsx b/web/src/components/ui/radio-group.tsxindex 31c1d4fe2..12c0f26e6 100644--- a/web/src/components/ui/radio-group.tsx+++ b/web/src/components/ui/radio-group.tsx@@ -2,6 +2,7 @@ import { Radio } from "@base-ui/react/radio";import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group";import { CircleIcon } from "lucide-react";import { cn } from "@/lib/utils";+import { FIELD_FOCUS_CLASSES } from "./focus";function RadioGroup({ className, ...props }: RadioGroupPrimitive.Props) {return <RadioGroupPrimitive data-slot="radio-group" className={cn("grid gap-3", className)} {...props} />;@@ -12,7 +13,9 @@ function RadioGroupItem({ className, ...props }: Radio.Root.Props) {<Radio.Rootdata-slot="radio-group-item"className={cn(- "border-border text-primary aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] data-disabled:cursor-not-allowed data-disabled:opacity-50",+ "border-input text-primary data-checked:border-primary aspect-square size-4 shrink-0 rounded-full border transition-[color,border-color] duration-150 data-disabled:cursor-not-allowed data-disabled:opacity-50 motion-reduce:transition-none",+ FIELD_FOCUS_CLASSES,+ "focus-visible:outline-offset-2",className,)}{...props}diff --git a/web/src/components/ui/select.tsx b/web/src/components/ui/select.tsxindex 36bc9413b..c94f85d1e 100644--- a/web/src/components/ui/select.tsx+++ b/web/src/components/ui/select.tsx@@ -1,6 +1,8 @@import { Select as SelectPrimitive } from "@base-ui/react/select";import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";import { cn } from "@/lib/utils";+import { FIELD_FOCUS_CLASSES } from "./focus";+import { popupMotionClasses, popupSurfaceClasses } from "./popup";type SelectProps = Omit<SelectPrimitive.Root.Props<string>, "onValueChange"> & {onValueChange?: (value: string) => void;@@ -39,7 +41,8 @@ function SelectTrigger({data-slot="select-trigger"data-size={size}className={cn(- "border-border data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex w-fit items-center justify-between rounded-md border bg-transparent text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=default]:gap-2 data-[size=default]:px-2 data-[size=default]:py-1 data-[size=sm]:h-7 data-[size=sm]:gap-2 data-[size=sm]:px-2 data-[size=sm]:py-1 data-[size=xs]:h-6 data-[size=xs]:gap-1 data-[size=xs]:px-1 data-[size=xs]:py-0.5 data-[size=xs]:text-xs *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",+ "border-border/80 data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex w-fit items-center justify-between rounded-md border bg-transparent text-sm whitespace-nowrap transition-[color,border-color,background-color] duration-150 hover:not-disabled:border-input data-popup-open:border-input data-popup-open:bg-muted/40 disabled:cursor-not-allowed disabled:bg-muted/50 disabled:opacity-50 data-[size=default]:h-8 data-[size=default]:gap-2 data-[size=default]:px-2 data-[size=default]:py-1 data-[size=sm]:h-7 data-[size=sm]:gap-1.5 data-[size=sm]:px-2 data-[size=sm]:py-1 data-[size=sm]:text-ui data-[size=xs]:h-6 data-[size=xs]:gap-1 data-[size=xs]:px-1.5 data-[size=xs]:py-0.5 data-[size=xs]:text-xs *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 motion-reduce:transition-none",+ FIELD_FOCUS_CLASSES,className,)}{...props}@@ -61,7 +64,7 @@ function SelectContent({alignOffset,positionMethod,side,- sideOffset = 4,+ sideOffset = 6,...props}: SelectContentProps) {return (@@ -78,14 +81,16 @@ function SelectContent({<SelectPrimitive.Popupdata-slot="select-content"className={cn(- "bg-popover text-popover-foreground relative z-dropdown max-h-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md transition-[opacity,scale,translate] duration-150 data-starting-style:scale-95 data-starting-style:opacity-0 data-ending-style:scale-95 data-ending-style:opacity-0 data-[side=bottom]:translate-y-1 data-[side=bottom]:data-starting-style:-translate-y-1 data-[side=bottom]:data-ending-style:-translate-y-1 data-[side=left]:-translate-x-1 data-[side=left]:data-starting-style:translate-x-1 data-[side=left]:data-ending-style:translate-x-1 data-[side=right]:translate-x-1 data-[side=right]:data-starting-style:-translate-x-1 data-[side=right]:data-ending-style:-translate-x-1 data-[side=top]:-translate-y-1 data-[side=top]:data-starting-style:translate-y-1 data-[side=top]:data-ending-style:translate-y-1",+ popupSurfaceClasses,+ "relative z-dropdown max-h-(--available-height) max-w-(--available-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto",+ popupMotionClasses,!alignItemWithTrigger && "w-full min-w-(--anchor-width) scroll-my-1",className,)}{...props}><SelectScrollUpButton />- <SelectPrimitive.List className="p-1">{children}</SelectPrimitive.List>+ <SelectPrimitive.List className="p-1.5">{children}</SelectPrimitive.List><SelectScrollDownButton /></SelectPrimitive.Popup></SelectPrimitive.Positioner>@@ -108,7 +113,7 @@ function SelectItem({ className, children, ...props }: SelectPrimitive.Item.Prop<SelectPrimitive.Itemdata-slot="select-item"className={cn(- "data-highlighted:bg-accent data-highlighted:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",+ "data-highlighted:bg-accent data-highlighted:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default min-h-8 items-center gap-2 rounded py-1.5 pe-8 ps-2 text-ui outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",className,)}{...props}@@ -127,7 +132,7 @@ function SelectSeparator({ className, ...props }: SelectPrimitive.Separator.Propreturn (<SelectPrimitive.Separatordata-slot="select-separator"- className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}+ className={cn("bg-border/60 pointer-events-none -mx-1.5 my-1.5 h-px", className)}{...props}/>);diff --git a/web/src/components/ui/sheet.tsx b/web/src/components/ui/sheet.tsxindex 17ba1621b..f50f56e92 100644--- a/web/src/components/ui/sheet.tsx+++ b/web/src/components/ui/sheet.tsx@@ -2,6 +2,7 @@ import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";import { XIcon } from "lucide-react";import * as React from "react";import { cn } from "@/lib/utils";+import { buttonVariants } from "./button";const Sheet = ({ ...props }: SheetPrimitive.Root.Props) => {return <SheetPrimitive.Root data-slot="sheet" {...props} />;@@ -27,7 +28,7 @@ const SheetOverlay = React.forwardRef<HTMLDivElement, SheetPrimitive.Backdrop.Prref={ref}data-slot="sheet-overlay"className={cn(- "fixed inset-0 z-overlay bg-overlay/50 transition-opacity duration-300 data-starting-style:opacity-0 data-ending-style:opacity-0",+ "fixed inset-0 z-overlay bg-overlay/50 transition-opacity duration-200 data-starting-style:opacity-0 data-ending-style:opacity-0 motion-reduce:transition-none",className,)}{...props}@@ -49,13 +50,15 @@ const SheetContent = React.forwardRef<ref={ref}data-slot="sheet-content"className={cn(- "bg-background fixed z-overlay flex flex-col gap-4 shadow-lg transition-transform duration-500 ease-in-out data-ending-style:duration-300",+ "bg-popover text-popover-foreground fixed z-overlay flex flex-col gap-4 border-border/70 shadow-float transition-transform duration-200 ease-out motion-reduce:transition-none",side === "right" &&- "inset-y-0 right-0 h-full w-3/4 border-l data-starting-style:translate-x-full data-ending-style:translate-x-full sm:max-w-sm",+ "inset-y-0 right-0 h-full w-3/4 border-l motion-safe:data-starting-style:translate-x-full motion-safe:data-ending-style:translate-x-full sm:max-w-sm",side === "left" &&- "inset-y-0 left-0 h-full w-3/4 border-r data-starting-style:-translate-x-full data-ending-style:-translate-x-full sm:max-w-sm",- side === "top" && "inset-x-0 top-0 h-auto border-b data-starting-style:-translate-y-full data-ending-style:-translate-y-full",- side === "bottom" && "inset-x-0 bottom-0 h-auto border-t data-starting-style:translate-y-full data-ending-style:translate-y-full",+ "inset-y-0 left-0 h-full w-3/4 border-r motion-safe:data-starting-style:-translate-x-full motion-safe:data-ending-style:-translate-x-full sm:max-w-sm",+ side === "top" &&+ "inset-x-0 top-0 h-auto border-b motion-safe:data-starting-style:-translate-y-full motion-safe:data-ending-style:-translate-y-full",+ side === "bottom" &&+ "inset-x-0 bottom-0 h-auto border-t motion-safe:data-starting-style:translate-y-full motion-safe:data-ending-style:translate-y-full",className,)}{...props}@@ -63,9 +66,9 @@ const SheetContent = React.forwardRef<{children}<SheetPrimitive.Closedata-slot="sheet-close"- className="ring-offset-background absolute top-4 end-4 rounded-xs opacity-60 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none"+ className={cn(buttonVariants({ variant: "quiet", size: "icon-compact" }), "absolute top-3 end-3")}>- <XIcon className="size-5" />+ <XIcon className="size-4" /><span className="sr-only">Close</span></SheetPrimitive.Close></SheetPrimitive.Popup>@@ -75,7 +78,7 @@ const SheetContent = React.forwardRef<SheetContent.displayName = "SheetContent";const SheetHeader = React.forwardRef<React.ElementRef<"div">, React.ComponentPropsWithoutRef<"div">>(({ className, ...props }, ref) => {- return <div ref={ref} data-slot="sheet-header" className={cn("flex flex-col gap-1.5 p-4", className)} {...props} />;+ return <div ref={ref} data-slot="sheet-header" className={cn("flex flex-col gap-1.5 p-4 pe-12", className)} {...props} />;});SheetHeader.displayName = "SheetHeader";@@ -85,7 +88,14 @@ const SheetFooter = React.forwardRef<React.ElementRef<"div">, React.ComponentProSheetFooter.displayName = "SheetFooter";const SheetTitle = React.forwardRef<HTMLHeadingElement, SheetPrimitive.Title.Props>(({ className, ...props }, ref) => {- return <SheetPrimitive.Title ref={ref} data-slot="sheet-title" className={cn("text-foreground font-semibold", className)} {...props} />;+ return (+ <SheetPrimitive.Title+ ref={ref}+ data-slot="sheet-title"+ className={cn("text-foreground text-base font-semibold leading-6", className)}+ {...props}+ />+ );});SheetTitle.displayName = "SheetTitle";@@ -94,7 +104,7 @@ const SheetDescription = React.forwardRef<HTMLParagraphElement, SheetPrimitive.D<SheetPrimitive.Descriptionref={ref}data-slot="sheet-description"- className={cn("text-muted-foreground text-sm", className)}+ className={cn("text-muted-foreground text-sm leading-5", className)}{...props}/>);diff --git a/web/src/components/ui/switch.tsx b/web/src/components/ui/switch.tsxindex 25413fbf7..27f5680d3 100644--- a/web/src/components/ui/switch.tsx+++ b/web/src/components/ui/switch.tsx@@ -1,12 +1,15 @@import { Switch as SwitchPrimitive } from "@base-ui/react/switch";import { cn } from "@/lib/utils";+import { FIELD_FOCUS_CLASSES } from "./focus";function Switch({ className, ...props }: SwitchPrimitive.Root.Props) {return (<SwitchPrimitive.Rootdata-slot="switch"className={cn(- "peer data-checked:bg-primary data-unchecked:bg-input inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all data-disabled:cursor-not-allowed data-disabled:opacity-50",+ "peer data-checked:bg-primary data-unchecked:bg-muted-foreground/30 inline-flex h-5 w-8 shrink-0 items-center rounded-full border border-transparent p-px transition-[background-color,border-color] duration-150 data-disabled:cursor-not-allowed data-disabled:opacity-50 motion-reduce:transition-none",+ FIELD_FOCUS_CLASSES,+ "focus-visible:outline-offset-2",className,)}{...props}@@ -14,7 +17,7 @@ function Switch({ className, ...props }: SwitchPrimitive.Root.Props) {<SwitchPrimitive.Thumbdata-slot="switch-thumb"className={cn(- "bg-background pointer-events-none block size-4 rounded-full ring-0 transition-transform data-checked:translate-x-[calc(100%-2px)] data-unchecked:translate-x-0 rtl:data-checked:-translate-x-[calc(100%-2px)]",+ "bg-control-thumb pointer-events-none block size-4 rounded-full shadow-xs transition-transform duration-150 data-checked:translate-x-3 data-unchecked:translate-x-0 rtl:data-checked:-translate-x-3 motion-reduce:transition-none",)}/></SwitchPrimitive.Root>diff --git a/web/src/components/ui/tabs.tsx b/web/src/components/ui/tabs.tsxindex 6955beeb9..c1c5b757e 100644--- a/web/src/components/ui/tabs.tsx+++ b/web/src/components/ui/tabs.tsx@@ -1,57 +1,64 @@+import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";import { cva } from "class-variance-authority";import { createContext, useContext } from "react";import { cn } from "@/lib/utils";+import { FOCUS_VISIBLE_OUTLINE_CLASSES } from "./focus";type TabsVariant = "segmented" | "underline";+type TabsSize = "default" | "sm";interface TabsContextValue {value: string;- onValueChange: (value: string) => void;variant: TabsVariant;+ size: TabsSize;}const TabsContext = createContext<TabsContextValue | null>(null);const useTabsContext = () => {const context = useContext(TabsContext);- if (!context) {- throw new Error("Tabs.* components must be rendered within <Tabs>");- }+ if (!context) throw new Error("Tabs.* components must be rendered within <Tabs>");return context;};-const tabsListVariants = cva("flex flex-row", {+const tabsListVariants = cva("flex flex-row items-center gap-0.5", {variants: {variant: {- segmented: "gap-1",- underline: "gap-1",+ segmented: "rounded-lg bg-muted/60 p-0.5",+ underline: "",},},defaultVariants: { variant: "segmented" },});const tabsTriggerVariants = cva(- "inline-flex items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium transition-colors cursor-pointer disabled:pointer-events-none disabled:opacity-50 [&_svg]:shrink-0",+ cn(+ "inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap font-medium transition-colors duration-150 cursor-pointer data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:shrink-0 motion-reduce:transition-none",+ FOCUS_VISIBLE_OUTLINE_CLASSES,+ ),{variants: {variant: {- segmented: "rounded-md px-3 py-1.5",- underline: "rounded-t-lg rounded-b-none border-b-2 px-3 py-2",+ segmented: "rounded-md",+ underline: "-mb-px rounded-t-md border-b-2",+ },+ size: {+ default: "h-8 px-3 text-sm",+ sm: "h-7 px-2 text-ui",},active: { true: "", false: "" },},compoundVariants: [- { variant: "segmented", active: true, className: "bg-background text-foreground shadow-sm" },+ { variant: "segmented", active: true, className: "bg-popover text-popover-foreground shadow-xs" },{ variant: "segmented", active: false, className: "text-muted-foreground hover:bg-background/50 hover:text-foreground" },- { variant: "underline", active: true, className: "border-primary bg-primary/5 text-primary" },+ { variant: "underline", active: true, className: "border-primary text-foreground" },{variant: "underline",active: false,- // The inactive tab is a quiet control: the same resting ink and hover wash as the button kit's `quiet` variant.- className: "border-transparent text-muted-foreground/70 hover:bg-muted/60 hover:text-foreground",+ className: "border-transparent text-muted-foreground hover:bg-muted/60 hover:text-foreground",},],- defaultVariants: { variant: "segmented", active: false },+ defaultVariants: { variant: "segmented", size: "default", active: false },},);@@ -59,42 +66,39 @@ interface TabsProps extends Omit<React.ComponentProps<"div">, "onChange"> {value: string;onValueChange: (value: string) => void;variant?: TabsVariant;+ size?: TabsSize;}-function Tabs({ value, onValueChange, variant = "segmented", children, ...props }: TabsProps) {+function Tabs({ value, onValueChange, variant = "segmented", size = "default", children, ...props }: TabsProps) {return (- <TabsContext.Provider value={{ value, onValueChange, variant }}>- <div {...props}>{children}</div>+ <TabsContext.Provider value={{ value, variant, size }}>+ <TabsPrimitive.Root value={value} onValueChange={(next) => typeof next === "string" && onValueChange(next)} {...props}>+ {children}+ </TabsPrimitive.Root></TabsContext.Provider>);}-function TabsList({ className, ...props }: React.ComponentProps<"div">) {+function TabsList({ className, activateOnFocus = true, ...props }: Omit<TabsPrimitive.List.Props, "className"> & { className?: string }) {const { variant } = useTabsContext();- return <div role="tablist" className={cn(tabsListVariants({ variant }), className)} {...props} />;+ return <TabsPrimitive.List activateOnFocus={activateOnFocus} className={cn(tabsListVariants({ variant }), className)} {...props} />;}-interface TabsTriggerProps extends Omit<React.ComponentProps<"button">, "value"> {+interface TabsTriggerProps extends Omit<TabsPrimitive.Tab.Props, "className" | "value"> {value: string;+ className?: string;}-function TabsTrigger({ value, className, onClick, ...props }: TabsTriggerProps) {- const { value: activeValue, onValueChange, variant } = useTabsContext();- const active = activeValue === value;+function TabsTrigger({ value, className, ...props }: TabsTriggerProps) {+ const { value: activeValue, variant, size } = useTabsContext();return (- <button- type="button"- role="tab"- aria-selected={active}- onClick={(event) => {- onValueChange(value);- onClick?.(event);- }}- className={cn(tabsTriggerVariants({ variant, active }), className)}+ <TabsPrimitive.Tab+ value={value}+ className={cn(tabsTriggerVariants({ variant, size, active: activeValue === value }), className)}{...props}/>);}-export type { TabsVariant };+export type { TabsSize, TabsVariant };export { Tabs, TabsList, TabsTrigger, tabsListVariants, tabsTriggerVariants };diff --git a/web/src/components/ui/textarea.tsx b/web/src/components/ui/textarea.tsxindex 7cfa482c9..21aede083 100644--- a/web/src/components/ui/textarea.tsx+++ b/web/src/components/ui/textarea.tsx@@ -1,12 +1,14 @@import * as React from "react";import { cn } from "@/lib/utils";+import { FIELD_FOCUS_CLASSES } from "./focus";function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {return (<textareadata-slot="textarea"className={cn(- "border-border placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",+ "border-border/80 placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base leading-6 transition-[color,border-color,background-color] duration-150 hover:not-disabled:border-input disabled:cursor-not-allowed disabled:bg-muted/50 disabled:opacity-50 md:text-sm md:leading-5 motion-reduce:transition-none",+ FIELD_FOCUS_CLASSES,className,)}{...props}diff --git a/web/src/components/ui/tooltip.tsx b/web/src/components/ui/tooltip.tsxindex dfc579392..049e63090 100644--- a/web/src/components/ui/tooltip.tsx+++ b/web/src/components/ui/tooltip.tsx@@ -19,7 +19,7 @@ TooltipTrigger.displayName = "TooltipTrigger";const TooltipContent = React.forwardRef<HTMLDivElement,TooltipPrimitive.Popup.Props & Pick<TooltipPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset">->(({ className, align, alignOffset, side, sideOffset = 0, children, ...props }, ref) => {+>(({ className, align, alignOffset, side, sideOffset = 6, children, ...props }, ref) => {return (<TooltipPrimitive.Portal><TooltipPrimitive.Positioner@@ -33,19 +33,13 @@ const TooltipContent = React.forwardRef<ref={ref}data-slot="tooltip-content"className={cn(- "bg-primary text-primary-foreground z-tooltip w-fit origin-(--transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",+ "bg-popover text-popover-foreground z-tooltip w-fit max-w-[min(16rem,var(--available-width))] origin-(--transform-origin) rounded-md border border-border/70 px-2 py-1 text-xs font-normal leading-4 tracking-normal text-pretty [overflow-wrap:anywhere] shadow-md",popupMotionClasses,className,)}{...props}>{children}- <TooltipPrimitive.Arrow- className={cn(- "pointer-events-none bg-primary z-tooltip size-2.5 rotate-45 rounded-[2px]",- "data-[side=top]:bottom-[-5px] data-[side=bottom]:top-[-5px] data-[side=left]:right-[-5px] data-[side=right]:left-[-5px]",- )}- /></TooltipPrimitive.Popup></TooltipPrimitive.Positioner></TooltipPrimitive.Portal>diff --git a/web/src/themes/COLOR_GUIDE.md b/web/src/themes/COLOR_GUIDE.mdindex 76222e434..e68774b3d 100644--- a/web/src/themes/COLOR_GUIDE.md+++ b/web/src/themes/COLOR_GUIDE.md@@ -51,7 +51,7 @@ The color system supports both light and dark themes automatically through CSS c| `--background` | Near white | Dark gray | Main page background || `--card` | Near white | Dark gray | Card/container backgrounds || `--card-foreground` | Very dark | Near white | Text on card backgrounds |-| `--popover` | Pure white | Darker gray | Overlay backgrounds |+| `--popover` | Pure white | Graphite | Floating surface backgrounds || `--popover-foreground` | Dark gray | Light gray | Text on overlay backgrounds || `--overlay` | Pure black | Pure black | Scrim behind modals |@@ -62,6 +62,24 @@ The color system supports both light and dark themes automatically through CSS c- Tooltips, dropdowns, modals (`--popover`)- Modal scrims (`--overlay`, always with an alpha utility: `bg-overlay/50` for dialogs and sheets, `bg-overlay/20` for focus mode)+### Floating surface details++Tooltip, popover, dropdown menu, and select surfaces use the `--popover` / `--popover-foreground` pair in every theme. Keep primary color for actions and selection, rather than ordinary hints.++- Tooltips: 12px text / 16px line height, 8px horizontal and 4px vertical padding, 6px radius, no arrow, and `shadow-md`. Long hints wrap at 16rem or the available viewport width.+- Interactive popups: `text-ui` (13px / 20px), 8px radius, `border-border/70`, and `shadow-float`. Default padding is 6px; content such as maps and search lists can own its padding.+- Menu and select rows: 32px default minimum height; compact menus retain 28px rows. Section labels and shortcuts use smaller, muted text.+- Default trigger gap: 6px. Submenus stay adjacent to their parent menu so the pointer can cross safely.+- Shared motion: 150ms, 2% scale and 4px travel; reduced-motion users get no transition. Positioning, collision handling, and keyboard behavior stay with Base UI.++The editor owns a separate set of floating elements. `MemoEditor/edit/editor.css` aligns their surfaces and tooltips with these values while preserving document typography.++### Form controls++Form fields share a visible keyboard outline and semantic invalid styling. Resting fields use a subtle border without a shadow; disabled fields use a muted surface. Small checkbox/radio/switch controls put their outline outside the glyph.++`--control-thumb` gives switch thumbs enough separation from the track in each scheme: it follows `--card` in light/paper and `--foreground` in dark. It reuses the theme palette rather than introducing a fixed white. The 32×20px switch has a 16px thumb and a 2px visual inset.+### ✏️ Text & Content Colors| Variable | Light Theme | Dark Theme | Usage |diff --git a/web/src/themes/default-dark.css b/web/src/themes/default-dark.cssindex 5a60d8fd1..9b06946a1 100644--- a/web/src/themes/default-dark.css+++ b/web/src/themes/default-dark.css@@ -5,6 +5,7 @@--card: oklch(0.275 0.009 255);--card-foreground: oklch(0.9 0.006 255);+ --control-thumb: var(--foreground);/* Popovers float above cards without becoming high-glare panels */--popover: oklch(0.32 0.01 255);diff --git a/web/src/themes/default.css b/web/src/themes/default.cssindex 81e36b475..bedfe9188 100644--- a/web/src/themes/default.css+++ b/web/src/themes/default.css@@ -3,6 +3,7 @@--foreground: oklch(0.2438 0.0269 95.7226);--card: oklch(1 0 0);--card-foreground: oklch(0.1908 0.002 106.5859);+ --control-thumb: var(--card);--popover: oklch(1 0 0);--popover-foreground: oklch(0.2671 0.0196 98.939);--primary: oklch(0.45 0.08 250);@@ -56,6 +57,7 @@--color-foreground: var(--foreground);--color-card: var(--card);--color-card-foreground: var(--card-foreground);+ --color-control-thumb: var(--control-thumb);--color-popover: var(--popover);--color-popover-foreground: var(--popover-foreground);--color-primary: var(--primary);diff --git a/web/tests/app-sidebar-logo.test.tsx b/web/tests/app-sidebar-logo.test.tsxindex ef8069fc8..8e77860e6 100644--- a/web/tests/app-sidebar-logo.test.tsx+++ b/web/tests/app-sidebar-logo.test.tsx@@ -241,7 +241,7 @@ describe("App sidebar logo", () => {expect(within(switcher).getByText("Memos logo")).toHaveAttribute("data-logo-size", "header");expect(switcher.querySelector(".lucide-chevrons-up-down")).not.toBeNull();expect(switcher.querySelector(".lucide-chevron-down")).toBeNull();- expect(compose).toHaveClass("size-7", "rounded-md", "border", "bg-background", "shadow-xs");+ expect(compose).toHaveClass("size-7", "rounded-md", "border", "border-border/80", "bg-transparent");expect(compose).not.toHaveClass("rounded-full");expect(header).not.toContainElement(search);expect(search).toHaveClass("ms-auto", "h-7", "px-1.5");@@ -613,7 +613,7 @@ describe("App sidebar logo", () => {const menu = await screen.findByRole("menu");expect(menu).toHaveAttribute("data-size", "sm");- expect(menu).toHaveClass("min-w-24", "p-0.5");+ expect(menu).toHaveClass("min-w-24", "p-1");const editItem = screen.getByRole("menuitem", { name: "common.edit" });const deleteItem = screen.getByRole("menuitem", { name: "common.delete" });expect(editItem.querySelector("svg")).toBeNull();diff --git a/web/tests/dropdown-menu-size.test.tsx b/web/tests/dropdown-menu-size.test.tsxindex 1c2369b50..0c54b429d 100644--- a/web/tests/dropdown-menu-size.test.tsx+++ b/web/tests/dropdown-menu-size.test.tsx@@ -27,7 +27,7 @@ describe("DropdownMenu sizing", () => {const menu = await screen.findByRole("menu");expect(menu).toHaveAttribute("data-size", "sm");- expect(menu).toHaveClass("min-w-24", "rounded", "p-0.5", "shadow-sm");+ expect(menu).toHaveClass("min-w-24", "rounded-lg", "p-1", "shadow-float");for (const item of screen.getAllByRole("menuitem")) {expect(item).toHaveClass("min-h-7", "px-2", "py-1", "text-ui");@@ -63,8 +63,8 @@ describe("DropdownMenu sizing", () => {const submenu = nestedAction.closest('[data-slot="dropdown-menu-content"]');expect(submenu).toHaveAttribute("data-side", "inline-end");expect(submenu).toHaveClass(- "data-[side=inline-end]:data-starting-style:-translate-x-2",- "rtl:data-[side=inline-end]:data-starting-style:translate-x-2",+ "data-[side=inline-end]:data-starting-style:-translate-x-1",+ "rtl:data-[side=inline-end]:data-starting-style:translate-x-1",);});});diff --git a/web/tests/quick-find-navigation.test.tsx b/web/tests/quick-find-navigation.test.tsxindex 838142beb..1af6dbd91 100644--- a/web/tests/quick-find-navigation.test.tsx+++ b/web/tests/quick-find-navigation.test.tsx@@ -116,6 +116,22 @@ describe("Quick Find navigation", () => {await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());});+ it("keeps keyboard focus on the mode tabs while preserving the draft", async () => {+ renderSearch();+ openQuickFind();+ fireEvent.change(await screen.findByRole("textbox"), { target: { value: "pinned" } });+ const textTab = screen.getByRole("tab", { name: "search.text" });+ act(() => textTab.focus());+ fireEvent.keyDown(textTab, { key: "ArrowRight" });+ const expressionTab = screen.getByRole("tab", { name: "search.expression-mode" });+ await waitFor(() => expect(expressionTab).toHaveFocus());+ expect(expressionTab).toHaveAttribute("aria-selected", "true");+ expect(screen.getByRole("textbox")).toHaveValue("pinned");+ fireEvent.keyDown(expressionTab, { key: "ArrowLeft" });+ await waitFor(() => expect(textTab).toHaveFocus());+ expect(textTab).toHaveAttribute("aria-selected", "true");+ });+it("restores the expression from its chip and discards cancelled changes", async () => {state.filters = [{ factor: "celSearch", value: "pinned\n || has_code" },diff --git a/web/tests/switch.test.tsx b/web/tests/switch.test.tsxindex 4f32e0192..75b0ccd3a 100644--- a/web/tests/switch.test.tsx+++ b/web/tests/switch.test.tsx@@ -11,6 +11,6 @@ describe("Switch", () => {expect(root).toHaveAttribute("aria-checked", "true");expect(thumb).toHaveAttribute("data-checked");- expect(thumb).toHaveClass("data-checked:translate-x-[calc(100%-2px)]", "rtl:data-checked:-translate-x-[calc(100%-2px)]");+ expect(thumb).toHaveClass("data-checked:translate-x-3", "rtl:data-checked:-translate-x-3");});});diff --git a/web/tests/tabs.test.tsx b/web/tests/tabs.test.tsxnew file mode 100644index 000000000..540f6b97a--- /dev/null+++ b/web/tests/tabs.test.tsx@@ -0,0 +1,73 @@+import { DirectionProvider } from "@base-ui/react/direction-provider";+import { act, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { useState } from "react";+import { describe, expect, it } from "vitest";+import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";++function Example() {+ const [value, setValue] = useState("general");+ return (+ <Tabs value={value} onValueChange={setValue} size="sm">+ <TabsList aria-label="Settings">+ <TabsTrigger value="general">General</TabsTrigger>+ <TabsTrigger value="disabled" disabled>+ Unavailable+ </TabsTrigger>+ <TabsTrigger value="members">Members</TabsTrigger>+ </TabsList>+ </Tabs>+ );+}++describe("Tabs keyboard navigation", () => {+ it("keeps disabled tabs discoverable without activating them, and maintains one tab stop", async () => {+ render(<Example />);+ const general = screen.getByRole("tab", { name: "General" });+ const members = screen.getByRole("tab", { name: "Members" });+ act(() => general.focus());+ fireEvent.keyDown(general, { key: "ArrowRight" });+ const disabled = screen.getByRole("tab", { name: "Unavailable" });+ await waitFor(() => expect(disabled).toHaveFocus());+ expect(disabled).toHaveAttribute("aria-selected", "false");+ expect(general).toHaveAttribute("aria-selected", "true");+ fireEvent.keyDown(disabled, { key: "Enter" });+ expect(disabled).toHaveAttribute("aria-selected", "false");+ fireEvent.keyDown(disabled, { key: "ArrowRight" });+ await waitFor(() => expect(members).toHaveFocus());+ expect(members).toHaveAttribute("aria-selected", "true");+ expect(members).toHaveAttribute("tabindex", "0");+ expect(general).toHaveAttribute("tabindex", "-1");+ expect(screen.getByRole("tab", { name: "Unavailable" })).toHaveAttribute("aria-selected", "false");+ fireEvent.keyDown(members, { key: "ArrowRight" });+ await waitFor(() => expect(general).toHaveFocus());+ });++ it("supports Home and End", async () => {+ render(<Example />);+ const general = screen.getByRole("tab", { name: "General" });+ const members = screen.getByRole("tab", { name: "Members" });+ act(() => general.focus());+ fireEvent.keyDown(general, { key: "End" });+ await waitFor(() => expect(members).toHaveFocus());+ fireEvent.keyDown(members, { key: "Home" });+ await waitFor(() => expect(general).toHaveFocus());+ expect(general).toHaveAttribute("aria-selected", "true");+ });++ it("follows the inline direction in RTL", async () => {+ render(+ <DirectionProvider direction="rtl">+ <Example />+ </DirectionProvider>,+ );+ const general = screen.getByRole("tab", { name: "General" });+ const members = screen.getByRole("tab", { name: "Members" });+ act(() => general.focus());+ fireEvent.keyDown(general, { key: "ArrowLeft" });+ const disabled = screen.getByRole("tab", { name: "Unavailable" });+ await waitFor(() => expect(disabled).toHaveFocus());+ fireEvent.keyDown(disabled, { key: "ArrowLeft" });+ await waitFor(() => expect(members).toHaveFocus());+ expect(members).toHaveAttribute("aria-selected", "true");+ });+});