🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(ui): clarify selected controls and suspend inactive menus (#17739)
Nikita Kabardinaac5c1783cb6
diff --git a/web/src/components/design-system/Checkbox/Checkbox.tsx b/web/src/components/design-system/Checkbox/Checkbox.tsxindex 6847c0801f..c9e2bd48bd 100644--- a/web/src/components/design-system/Checkbox/Checkbox.tsx+++ b/web/src/components/design-system/Checkbox/Checkbox.tsx@@ -32,7 +32,14 @@ type CheckboxProps = Pick<React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>,"className">,- "aria-label" | "checked" | "disabled" | "id" | "onCheckedChange" | "onClick"+ | "aria-label"+ | "aria-hidden"+ | "checked"+ | "disabled"+ | "id"+ | "onCheckedChange"+ | "onClick"+ | "tabIndex"> &VariantProps<typeof checkboxVariants>;diff --git a/web/src/components/design-system/MultiSelectInput/MultiSelectInput.stories.tsx b/web/src/components/design-system/MultiSelectInput/MultiSelectInput.stories.tsxindex 26a57847f0..369c1c70b0 100644--- a/web/src/components/design-system/MultiSelectInput/MultiSelectInput.stories.tsx+++ b/web/src/components/design-system/MultiSelectInput/MultiSelectInput.stories.tsx@@ -94,6 +94,35 @@ export const LargeList = meta.story({},});+export const MultipleSelected = meta.story({+ args: {+ value: ["production", "regression"],+ options,+ onValueChange: fn(),+ placeholder: "Choose score fields",+ selectedLabel: "2 score fields selected",+ searchPlaceholder: "Search score fields...",+ emptyMessage: "No score fields found.",+ },+ render: (args) => {+ const [value, setValue] = useState(args.value);++ return (+ <div className="w-[640px] max-w-full">+ <MultiSelectInput+ {...args}+ value={value}+ selectedLabel={`${value.length} score fields selected`}+ onValueChange={(newValue) => {+ setValue(newValue);+ args.onValueChange(newValue);+ }}+ />+ </div>+ );+ },+});+export const TestSelectsMultipleOptions = meta.story({name: "(Test) Selects Multiple Options",args: {diff --git a/web/src/components/design-system/MultiSelectInput/MultiSelectInput.tsx b/web/src/components/design-system/MultiSelectInput/MultiSelectInput.tsxindex 805d6643d3..7e05fd659f 100644--- a/web/src/components/design-system/MultiSelectInput/MultiSelectInput.tsx+++ b/web/src/components/design-system/MultiSelectInput/MultiSelectInput.tsx@@ -15,6 +15,7 @@ type MultiSelectOption<V> = {value: V;label: string;secondaryLabel?: string;+ disabled?: boolean;};type MultiSelectInputProps<V> = {@@ -28,7 +29,7 @@ type MultiSelectInputProps<V> = {error?: boolean;} & Pick<React.ComponentPropsWithoutRef<"button">,- "id" | "aria-describedby" | "aria-invalid"+ "id" | "aria-describedby" | "aria-invalid" | "aria-label">;function MultiSelectInputInner<V extends string>(@@ -100,10 +101,13 @@ function MultiSelectInputInner<V extends string>(<InputDropdown.Optionkey={option.value}highlight="aria-selected"+ checked={isSelected}><CommandPrimitive.Itemvalue={option.value}keywords={[option.label]}+ disabled={option.disabled}+ aria-checked={isSelected}onSelect={() => {if (isSelected) {onValueChange(@@ -122,11 +126,8 @@ function MultiSelectInputInner<V extends string>(label={option.label}title={option.label}secondaryLabel={option.secondaryLabel}- indicator={- <InputDropdown.CheckIndicator- checked={isSelected}- />- }+ type="checkbox"+ checked={isSelected}/></CommandPrimitive.Item></InputDropdown.Option>diff --git a/web/src/components/design-system/MultiSelectTagInput/MultiSelectTagInput.stories.tsx b/web/src/components/design-system/MultiSelectTagInput/MultiSelectTagInput.stories.tsxindex 73f275ce9e..7fc22b3abe 100644--- a/web/src/components/design-system/MultiSelectTagInput/MultiSelectTagInput.stories.tsx+++ b/web/src/components/design-system/MultiSelectTagInput/MultiSelectTagInput.stories.tsx@@ -102,6 +102,71 @@ export const ManySelected = meta.story({),});+export const MultipleSelected = meta.story({+ args: {+ value: ["option-1", "option-3"],+ options,+ onValueChange: fn(),+ placeholder: "Select options",+ searchPlaceholder: "Search options...",+ emptyMessage: "No options found.",+ selectAllLabel: "Select All",+ },+ render: (args) => {+ const [value, setValue] = useState(args.value);++ return (+ <div className="w-[640px] max-w-full">+ <MultiSelectTagInput+ {...args}+ value={value}+ onValueChange={(newValue) => {+ setValue(newValue);+ args.onValueChange(newValue);+ }}+ />+ </div>+ );+ },+});++export const SecondaryLabels = meta.story({+ args: {+ value: ["legacy-rating", "quality"],+ options: [+ {+ value: "legacy-rating",+ label: "Legacy rating",+ secondaryLabel: "Archived",+ showSecondaryLabelInTag: true,+ disabled: true,+ },+ { value: "quality", label: "Quality", secondaryLabel: "(current)" },+ { value: "accuracy", label: "Accuracy" },+ ],+ onValueChange: fn(),+ placeholder: "Choose scores",+ searchPlaceholder: "Search scores...",+ emptyMessage: "No scores found.",+ },+ render: (args) => {+ const [value, setValue] = useState(args.value);++ return (+ <div className="w-[640px] max-w-full">+ <MultiSelectTagInput+ {...args}+ value={value}+ onValueChange={(newValue) => {+ setValue(newValue);+ args.onValueChange(newValue);+ }}+ />+ </div>+ );+ },+});+export const TestRemovesTag = meta.story({name: "(Test) Removes Tag",args: {@@ -203,3 +268,28 @@ export const TestOverflowBadgePlacement = meta.story({});},});++export const TestKeepsDisabledTagsWhenClearing = meta.story({+ name: "(Test) Keeps Disabled Tags When Clearing",+ args: {+ value: ["option-1", "option-2", "option-3"],+ options: options.map((option) => ({+ ...option,+ disabled: option.value === "option-1",+ })),+ onValueChange: fn(),+ placeholder: "Select options",+ searchPlaceholder: "Search options...",+ emptyMessage: "No options found.",+ },+ play: async ({ args, canvasElement }) => {+ const canvas = within(canvasElement);+ await expect(+ canvas.getByRole("button", { name: "Remove Option 1" }),+ ).toBeDisabled();+ await userEvent.click(+ canvas.getByRole("button", { name: "Clear selection" }),+ );+ await expect(args.onValueChange).toHaveBeenCalledWith(["option-1"]);+ },+});diff --git a/web/src/components/design-system/MultiSelectTagInput/MultiSelectTagInput.tsx b/web/src/components/design-system/MultiSelectTagInput/MultiSelectTagInput.tsxindex 1e7d639305..3ac43e46ee 100644--- a/web/src/components/design-system/MultiSelectTagInput/MultiSelectTagInput.tsx+++ b/web/src/components/design-system/MultiSelectTagInput/MultiSelectTagInput.tsx@@ -14,6 +14,9 @@ import { InputDropdown } from "../internal/InputDropdown/InputDropdown";type MultiSelectTagOption<V> = {value: V;label: string;+ disabled?: boolean;+ secondaryLabel?: string;+ showSecondaryLabelInTag?: boolean;};type MultiSelectTagInputProps<V> = {@@ -27,6 +30,7 @@ type MultiSelectTagInputProps<V> = {disabled?: boolean;error?: boolean;id?: string;+ "aria-label"?: string;"aria-describedby"?: string;"aria-invalid"?: boolean;};@@ -42,6 +46,7 @@ export function MultiSelectTagInput<V extends string>({disabled,error,id,+ "aria-label": ariaLabel,"aria-describedby": ariaDescribedBy,"aria-invalid": ariaInvalid,}: MultiSelectTagInputProps<V>) {@@ -56,17 +61,26 @@ export function MultiSelectTagInput<V extends string>({const listId = React.useId();const selectedOptions = React.useMemo(() =>- value.map((selectedValue) => ({- value: selectedValue,- label:- options.find((option) => option.value === selectedValue)?.label ??- selectedValue,- })),+ value.map((selectedValue) => {+ const option = options.find((option) => option.value === selectedValue);+ return {+ value: selectedValue,+ label: option?.label ?? selectedValue,+ disabled: option?.disabled,+ secondaryLabel: option?.showSecondaryLabelInTag+ ? option.secondaryLabel+ : undefined,+ };+ }),[options, value],);+ const enabledOptions = options.filter((option) => !option.disabled);+ const disabledValues = options+ .filter((option) => option.disabled)+ .map((option) => option.value);const allSelected =- options.length > 0 &&- options.every((option) => value.includes(option.value));+ enabledOptions.length > 0 &&+ enabledOptions.every((option) => value.includes(option.value));const hiddenOptionCount = selectedOptions.filter((option) => !fullyVisibleValues.has(option.value),).length;@@ -126,7 +140,17 @@ export function MultiSelectTagInput<V extends string>({const changeValue = (newValue: V[]) => {if (disabled) return;- onValueChange(newValue);+ onValueChange([+ ...newValue.filter(+ (nextValue) =>+ !disabledValues.includes(nextValue) || value.includes(nextValue),+ ),+ ...value.filter(+ (currentValue) =>+ disabledValues.includes(currentValue) &&+ !newValue.includes(currentValue),+ ),+ ]);};const removeValue = (removedValue: V) => {@@ -147,7 +171,9 @@ export function MultiSelectTagInput<V extends string>({<PopoverPrimitive.Trigger asChild><divid={id}+ className="cursor-pointer aria-disabled:cursor-not-allowed"role="combobox"+ aria-label={ariaLabel}aria-controls={listId}aria-describedby={ariaDescribedBy}aria-expanded={open}@@ -173,7 +199,11 @@ export function MultiSelectTagInput<V extends string>({if (event.key === "Backspace" && value.length > 0) {event.preventDefault();- const lastValue = value.at(-1);+ const lastValue = value+ .filter(+ (selectedValue) => !disabledValues.includes(selectedValue),+ )+ .at(-1);if (lastValue !== undefined) removeValue(lastValue);}}}@@ -202,20 +232,27 @@ export function MultiSelectTagInput<V extends string>({tagRefs.current.delete(option.value);}}data-value={option.value}- title={option.label}+ title={[option.label, option.secondaryLabel]+ .filter(Boolean)+ .join(" ")}className={cn(- "bg-muted flex h-6 max-w-48 min-w-10 shrink items-center gap-1 rounded px-2",+ "bg-muted flex h-6 max-w-48 min-w-10 shrink-0 items-center gap-1 rounded px-2",!fullyVisibleValues.has(option.value) && "invisible",)}><span className="min-w-0 truncate" title={option.label}>{option.label}</span>+ {option.secondaryLabel ? (+ <span className="text-muted-foreground shrink-0">+ {option.secondaryLabel}+ </span>+ ) : null}<buttontype="button"- disabled={disabled}+ disabled={disabled || option.disabled}aria-label={`Remove ${option.label}`}- className="text-muted-foreground hover:text-foreground -mr-1 flex shrink-0 items-center rounded-sm"+ className="text-muted-foreground hover:text-foreground -mr-1 flex shrink-0 items-center rounded-sm disabled:cursor-not-allowed"onClick={(event) => {event.stopPropagation();removeValue(option.value);@@ -247,10 +284,15 @@ export function MultiSelectTagInput<V extends string>({{value.length > 0 && (<buttontype="button"- disabled={disabled}+ disabled={+ disabled ||+ value.every((selectedValue) =>+ disabledValues.includes(selectedValue),+ )+ }data-clear-selectionaria-label="Clear selection"- className="text-muted-foreground hover:text-foreground ml-auto flex shrink-0 items-center rounded-sm px-1"+ className="text-muted-foreground hover:text-foreground ml-auto flex shrink-0 items-center rounded-sm px-1 disabled:cursor-not-allowed"onClick={(event) => {event.stopPropagation();changeValue([]);@@ -268,6 +310,9 @@ export function MultiSelectTagInput<V extends string>({<PopoverPrimitive.Contentalign="start"sideOffset={4}+ onCloseAutoFocus={(event) => {+ if (disabled) event.preventDefault();+ }}onWheel={stopScrollPropagation()}onTouchMove={stopScrollPropagation()}>@@ -285,9 +330,14 @@ export function MultiSelectTagInput<V extends string>({<CommandPrimitive.List id={listId}><CommandPrimitive.Group className="text-foreground overflow-hidden">{selectAllLabel && options.length > 0 && (- <InputDropdown.Option highlight="aria-selected">+ <InputDropdown.Option+ highlight="aria-selected"+ checked={allSelected}+ ><CommandPrimitive.Itemvalue={selectAllLabel}+ aria-checked={allSelected}+ disabled={enabledOptions.length === 0}onSelect={() =>changeValue(allSelected@@ -299,11 +349,8 @@ export function MultiSelectTagInput<V extends string>({<InputDropdown.OptionContentlabel={selectAllLabel}title={selectAllLabel}- indicator={- <InputDropdown.CheckIndicator- checked={allSelected}- />- }+ type="checkbox"+ checked={allSelected}/></CommandPrimitive.Item></InputDropdown.Option>@@ -313,15 +360,25 @@ export function MultiSelectTagInput<V extends string>({)}{options.map((option) => {const isSelected = value.includes(option.value);+ const visibleLabel = [+ option.label,+ option.secondaryLabel,+ ]+ .filter(Boolean)+ .join(" ");return (<InputDropdown.Optionkey={option.value}highlight="aria-selected"+ checked={isSelected}><CommandPrimitive.Itemvalue={option.value || option.label}- keywords={[option.label]}+ keywords={[visibleLabel]}+ aria-label={visibleLabel}+ aria-checked={isSelected}+ disabled={option.disabled}onSelect={() => {if (isSelected) {removeValue(option.value);@@ -333,12 +390,10 @@ export function MultiSelectTagInput<V extends string>({><InputDropdown.OptionContentlabel={option.label}- title={option.label}- indicator={- <InputDropdown.CheckIndicator- checked={isSelected}- />- }+ secondaryLabel={option.secondaryLabel}+ title={visibleLabel}+ type="checkbox"+ checked={isSelected}/></CommandPrimitive.Item></InputDropdown.Option>diff --git a/web/src/components/design-system/SelectInput/SelectInput.tsx b/web/src/components/design-system/SelectInput/SelectInput.tsxindex 27189f66e1..d0e36b6c26 100644--- a/web/src/components/design-system/SelectInput/SelectInput.tsx+++ b/web/src/components/design-system/SelectInput/SelectInput.tsx@@ -98,24 +98,21 @@ function SelectInputInner<V extends string>(disabled={node.disabled}><InputDropdown.OptionContent+ type="checkmark"+ checked={value === node.value}label={<SelectPrimitive.ItemText>{node.label}</SelectPrimitive.ItemText>}title={node.disabled ? node.disabledReason : node.label}- indicator={- <SelectPrimitive.ItemIndicator>- <InputDropdown.CheckIndicator checked />- </SelectPrimitive.ItemIndicator>- }/></SelectPrimitive.SelectItem></InputDropdown.Option></React.Fragment>);},- [],+ [value],);return (@@ -147,7 +144,7 @@ function SelectInputInner<V extends string>(<SelectPrimitive.Content position="popper" sideOffset={4}><SelectPrimitive.ScrollUpButtonaria-label="Scroll up"- className="animate-in fade-in-0 fill-mode-both absolute inset-x-0 top-0 z-3 flex h-6 items-center justify-center duration-300 [animation-delay:.5s]"+ className="animate-in fade-in-0 fill-mode-both absolute inset-x-0 top-0 z-3 flex h-6 cursor-pointer items-center justify-center duration-300 [animation-delay:.5s]"><ChevronUp className="size-4" /></SelectPrimitive.ScrollUpButton>@@ -169,7 +166,7 @@ function SelectInputInner<V extends string>(</InputDropdown.List><SelectPrimitive.ScrollDownButtonaria-label="Scroll down"- className="animate-in fade-in-0 fill-mode-both absolute inset-x-0 bottom-0 z-3 flex h-6 items-center justify-center duration-300 [animation-delay:.5s]"+ className="animate-in fade-in-0 fill-mode-both absolute inset-x-0 bottom-0 z-3 flex h-6 cursor-pointer items-center justify-center duration-300 [animation-delay:.5s]"><ChevronDown className="size-4" /></SelectPrimitive.ScrollDownButton>diff --git a/web/src/components/design-system/internal/InputDropdown/InputDropdown.tsx b/web/src/components/design-system/internal/InputDropdown/InputDropdown.tsxindex b690459e4b..310860bf4f 100644--- a/web/src/components/design-system/internal/InputDropdown/InputDropdown.tsx+++ b/web/src/components/design-system/internal/InputDropdown/InputDropdown.tsx@@ -4,6 +4,7 @@ import { type ComponentPropsWithoutRef, type ReactNode } from "react";import { useScrollGradients } from "@/src/hooks/useScrollGradients";import { cn } from "@/src/utils/tailwind";+import { Checkbox } from "../../Checkbox/Checkbox";type SlottedProps = Omit<ComponentPropsWithoutRef<typeof Slot>, "className">;@@ -81,14 +82,17 @@ function List({ ...props }: SlottedProps) {function Option({highlight,+ checked,...props}: SlottedProps & {highlight: "aria-selected" | "focus";+ checked?: boolean;}) {return (<Slot+ data-checked={checked}className={cn(- "relative flex w-full cursor-default items-center rounded-sm px-1.5 py-1.5 text-sm outline-hidden select-none",+ "relative flex w-full cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1.5 text-sm outline-hidden select-none aria-disabled:cursor-not-allowed aria-disabled:opacity-50",highlight === "aria-selected"? "aria-selected:bg-accent aria-selected:text-accent-foreground": "focus:bg-accent focus:text-accent-foreground data-disabled:opacity-50",@@ -102,12 +106,14 @@ function OptionContent({label,secondaryLabel,title,- indicator,+ type,+ checked,}: {label: ReactNode;secondaryLabel?: string;title: string;- indicator: ReactNode;+ type: "checkbox" | "checkmark";+ checked: boolean;}) {return (<>@@ -117,21 +123,31 @@ function OptionContent({<span className="text-muted-foreground ml-1">{secondaryLabel}</span>)}</span>- <span className="flex size-3.5 shrink-0 items-center justify-center">- {indicator}+ <span+ className={cn(+ "pointer-events-none flex size-3.5 shrink-0 items-center justify-center",+ type === "checkbox" && "order-first",+ )}+ >+ {type === "checkbox" ? (+ <Checkbox+ checked={checked}+ size="sm"+ tabIndex={-1}+ aria-hidden="true"+ />+ ) : (+ <Check+ aria-hidden="true"+ className={cn("size-4", checked ? "opacity-100" : "opacity-0")}+ />+ )}</span></>);}-function CheckIndicator({ checked }: { checked: boolean }) {- return (- <Check className={cn("size-4", checked ? "opacity-100" : "opacity-0")} />- );-}-export const InputDropdown = {- CheckIndicator,Content,Empty,List,diff --git a/web/src/components/ui/combobox.tsx b/web/src/components/ui/combobox.tsxindex 020fcac4bf..c114f6ec33 100644--- a/web/src/components/ui/combobox.tsx+++ b/web/src/components/ui/combobox.tsx@@ -122,8 +122,9 @@ export function Combobox<T extends string | number | boolean | { id: string }>({return (<Popover- open={open}+ open={!disabled && open}onOpenChange={(nextOpen) => {+ if (disabled) return;setOpen(nextOpen);if (!nextOpen) setSearch("");}}@@ -132,7 +133,7 @@ export function Combobox<T extends string | number | boolean | { id: string }>({<Buttonvariant="outline"role="combobox"- aria-expanded={open}+ aria-expanded={!disabled && open}className={cn("w-full justify-between text-xs font-normal",!value && "text-muted-foreground",@@ -157,7 +158,12 @@ export function Combobox<T extends string | number | boolean | { id: string }>({<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" /></Button></PopoverTrigger>- <PopoverContent className="w-(--radix-popover-trigger-width) p-0">+ <PopoverContent+ className="w-(--radix-popover-trigger-width) p-0"+ onCloseAutoFocus={(event) => {+ if (disabled) event.preventDefault();+ }}+ ><Command><CommandInputplaceholder={searchPlaceholder}diff --git a/web/src/components/ui/command.tsx b/web/src/components/ui/command.tsxindex 976d9df4e7..2089d90920 100644--- a/web/src/components/ui/command.tsx+++ b/web/src/components/ui/command.tsx@@ -163,7 +163,7 @@ const CommandItem = React.forwardRef<ref={ref}className={cn(className,- "data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",+ "data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",)}{...props}/>diff --git a/web/src/components/ui/dropdown-menu.clienttest.tsx b/web/src/components/ui/dropdown-menu.clienttest.tsxindex 871dda8fb0..35deaef152 100644--- a/web/src/components/ui/dropdown-menu.clienttest.tsx+++ b/web/src/components/ui/dropdown-menu.clienttest.tsx@@ -1,7 +1,9 @@-import { render, screen } from "@testing-library/react";+import { fireEvent, render, screen, waitFor } from "@testing-library/react";import {DropdownMenu,DropdownMenuContent,+ DropdownMenuController,+ DropdownMenuItem,DropdownMenuItemWithSecondaryAction,} from "@/src/components/ui/dropdown-menu";import { LayerProvider } from "@/src/context/LayerContext/LayerContext";@@ -26,3 +28,32 @@ describe("DropdownMenuItemWithSecondaryAction", () => {expect(link).toHaveAttribute("rel", "noopener noreferrer");});});++describe("DropdownMenuController", () => {+ it("suspends an open menu while its owner is inactive without restoring focus", async () => {+ const menu = (isActive: boolean) => (+ <DropdownMenuController+ align="start"+ isActive={isActive}+ renderMenu={() => <DropdownMenuItem>Clear value</DropdownMenuItem>}+ >+ {({ Trigger }) => <Trigger>Actions</Trigger>}+ </DropdownMenuController>+ );+ const { rerender } = render(menu(true), { wrapper: LayerProvider });+ const trigger = screen.getByRole("button", { name: "Actions" });+ fireEvent.keyDown(trigger, { key: "ArrowDown" });+ expect(await screen.findByRole("menuitem")).toHaveTextContent(+ "Clear value",+ );++ rerender(menu(false));+ await waitFor(() => expect(screen.queryByRole("menu")).toBeNull());+ expect(trigger).not.toHaveFocus();++ rerender(menu(true));+ expect(await screen.findByRole("menuitem")).toHaveTextContent(+ "Clear value",+ );+ });+});diff --git a/web/src/components/ui/dropdown-menu.tsx b/web/src/components/ui/dropdown-menu.tsxindex cd0c277e33..41d7c2d42d 100644--- a/web/src/components/ui/dropdown-menu.tsx+++ b/web/src/components/ui/dropdown-menu.tsx@@ -265,6 +265,7 @@ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;*/type DropdownMenuControllerProps = {align: React.ComponentProps<typeof DropdownMenuContent>["align"];+ isActive?: boolean;children: (control: {isOpen: boolean;Trigger: typeof DropdownMenuTrigger;@@ -279,6 +280,7 @@ type DropdownMenuControllerProps = {const DropdownMenuController = ({align,+ isActive = true,children,maxWidth,onCloseAutoFocus,@@ -287,13 +289,16 @@ const DropdownMenuController = ({const [isOpen, setIsOpen] = React.useState(false);return (- <DropdownMenu open={isOpen} onOpenChange={setIsOpen}>- {children({ isOpen, Trigger: DropdownMenuTrigger })}+ <DropdownMenu open={isActive && isOpen} onOpenChange={setIsOpen}>+ {children({ isOpen: isActive && isOpen, Trigger: DropdownMenuTrigger })}<DropdownMenuContentalign={align}style={maxWidth === undefined ? undefined : { maxWidth }}onClick={(event) => event.stopPropagation()}- onCloseAutoFocus={onCloseAutoFocus}+ onCloseAutoFocus={(event) => {+ if (!isActive) event.preventDefault();+ onCloseAutoFocus?.(event);+ }}>{renderMenu()}</DropdownMenuContent>diff --git a/web/src/components/ui/input-command.tsx b/web/src/components/ui/input-command.tsxindex ab72609870..bfef05c07d 100644--- a/web/src/components/ui/input-command.tsx+++ b/web/src/components/ui/input-command.tsx@@ -118,7 +118,7 @@ const InputCommandItem = React.forwardRef<<CommandPrimitive.Itemref={ref}className={cn(- "aria-selected:bg-accent aria-selected:text-accent-foreground relative flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none",+ "aria-selected:bg-accent aria-selected:text-accent-foreground relative flex cursor-pointer items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:cursor-not-allowed",className,)}{...props}diff --git a/web/src/components/ui/overlay-scroll.clienttest.tsx b/web/src/components/ui/overlay-scroll.clienttest.tsxindex e288944ced..d2af546992 100644--- a/web/src/components/ui/overlay-scroll.clienttest.tsx+++ b/web/src/components/ui/overlay-scroll.clienttest.tsx@@ -6,7 +6,8 @@* overlay — otherwise a scrollable list in a picker opened from a dialog freezes* for wheel and touch while keyboard navigation still works.*/-import { fireEvent, render, screen } from "@testing-library/react";+import { fireEvent, render, screen, waitFor } from "@testing-library/react";+import { Combobox } from "@/src/components/ui/combobox";import {Popover,PopoverContent,@@ -20,6 +21,7 @@ import {describe("overlay content keeps scroll events local", () => {beforeAll(() => {+ Element.prototype.scrollIntoView = vi.fn();vi.stubGlobal("ResizeObserver",class {@@ -86,4 +88,22 @@ describe("overlay content keeps scroll events local", () => {expect(atDocument).toEqual(["wheel", "touchmove"]);});++ it("disabling a combobox suspends an already open portal", async () => {+ const onValueChange = vi.fn();+ const selector = (disabled: boolean) => (+ <Combobox+ options={[{ value: "one", label: "First option" }]}+ onValueChange={onValueChange}+ disabled={disabled}+ />+ );+ const { rerender } = render(selector(false));+ fireEvent.click(screen.getByRole("combobox"));+ expect(await screen.findByRole("option")).toHaveTextContent("First option");++ rerender(selector(true));+ await waitFor(() => expect(screen.queryByRole("option")).toBeNull());+ expect(onValueChange).not.toHaveBeenCalled();+ });});diff --git a/web/src/components/ui/popover.tsx b/web/src/components/ui/popover.tsxindex 6265c5289a..d4f6cf4bfa 100644--- a/web/src/components/ui/popover.tsx+++ b/web/src/components/ui/popover.tsx@@ -16,7 +16,9 @@ const PopoverAnchor = PopoverPrimitive.Anchor;const PopoverContent = React.forwardRef<React.ComponentRef<typeof PopoverPrimitive.Content>,- React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {+ portalContainer?: HTMLElement | null;+ }>(({@@ -26,6 +28,7 @@ const PopoverContent = React.forwardRef<forceMount,onWheel,onTouchMove,+ portalContainer,...props},ref,@@ -40,7 +43,10 @@ const PopoverContent = React.forwardRef<// need mounted-but-hidden content (e.g. a child whose effect must keep running// while the popover is closed). Undefined for everyone else → default behavior.return (- <PopoverPrimitive.Portal container={container} forceMount={forceMount}>+ <PopoverPrimitive.Portal+ container={portalContainer ?? container}+ forceMount={forceMount}+ ><PopoverPrimitive.Contentref={ref}align={align}diff --git a/web/src/components/ui/select.tsx b/web/src/components/ui/select.tsxindex 6f421e4a17..d647a55b6f 100644--- a/web/src/components/ui/select.tsx+++ b/web/src/components/ui/select.tsx@@ -62,7 +62,7 @@ const SelectScrollUpButton = React.forwardRef<<SelectPrimitive.ScrollUpButtonref={ref}className={cn(- "flex cursor-default items-center justify-center py-1",+ "flex cursor-pointer items-center justify-center py-1",className,)}{...props}@@ -79,7 +79,7 @@ const SelectScrollDownButton = React.forwardRef<<SelectPrimitive.ScrollDownButtonref={ref}className={cn(- "flex cursor-default items-center justify-center py-1",+ "flex cursor-pointer items-center justify-center py-1",className,)}{...props}@@ -147,7 +147,7 @@ const SelectItem = React.forwardRef<<SelectPrimitive.Itemref={ref}className={cn(- "focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50",+ "focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-pointer items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50",className,)}{...props}diff --git a/web/src/components/ui/side-panel.tsx b/web/src/components/ui/side-panel.tsxindex d0327d6a9c..832bca0ca0 100644--- a/web/src/components/ui/side-panel.tsx+++ b/web/src/components/ui/side-panel.tsx@@ -109,17 +109,27 @@ const SidePanel = ({{!isControlled && (<div className="border-l px-1 pt-2"><SheetTrigger asChild>- <Button variant="ghost" size="icon" className="h-8 w-8">+ <Button+ variant="ghost"+ size="icon"+ className="h-8 w-8"+ title="Show details"+ ><ChevronLeft className="h-4 w-4" /></Button></SheetTrigger></div>)}- <SheetContent>- <SheetHeader>+ <SheetContent className="flex flex-col overflow-hidden">+ <SheetHeader className="shrink-0"><SheetTitle>{mobileTitle}</SheetTitle></SheetHeader>- <div className="mt-2 flex h-full w-full flex-col gap-2">+ <div+ className={cn(+ "flex min-h-0 w-full flex-1 flex-col gap-2",+ scrollable ? "overflow-y-auto" : "overflow-hidden",+ )}+ >{children}</div></SheetContent>