🪢 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(web): retire ui/toggle-group onto design-system Tabs inset (#18475)
Trang Nguyen2a76a0cf206b
diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 604e6614da..1c4489406a 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -681,9 +681,6 @@ importers:'@radix-ui/react-toggle':specifier: ^1.1.10version: 1.1.10(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])- '@radix-ui/react-toggle-group':- specifier: ^1.1.11- version: 1.1.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])'@radix-ui/react-tooltip':specifier: ^1.2.8version: 1.2.8(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])@@ -5125,19 +5122,6 @@ packages:'@types/react-dom':optional: true- '@radix-ui/[email protected]':- resolution: {integrity: sha512-5umnS0T8JQzQT6HbPyO7Hh9dgd82NmS36DQr+X/YJ9ctFNCiiQd6IJAYYZ33LUwm8M+taCz5t2ui29fHZc4Y6Q==}- peerDependencies:- '@types/react': '*'- '@types/react-dom': 19.2.3- react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc- react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc- peerDependenciesMeta:- '@types/react':- optional: true- '@types/react-dom':- optional: true-'@radix-ui/[email protected]':resolution: {integrity: sha512-lS1odchhFTeZv3xwHH31YPObmJn8gOg7Lq12inrr0+BH/l3Tsq32VfjqH1oh80ARM3mlkfMic15n0kg4sD1poQ==}peerDependencies:@@ -16673,21 +16657,6 @@ snapshots:'@types/react': 19.2.14'@types/react-dom': 19.2.3(@types/[email protected])- '@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':- dependencies:- '@radix-ui/primitive': 1.1.3- '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])- '@radix-ui/react-direction': 1.1.1(@types/[email protected])([email protected])- '@radix-ui/react-primitive': 2.1.3(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])- '@radix-ui/react-roving-focus': 1.1.11(patch_hash=fb2bc2e96ad2c31dcb5860e509374a512fa08b1fade5805e3ae2dc72dcd68a0b)(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])- '@radix-ui/react-toggle': 1.1.10(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])- '@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])- react: 19.2.4- react-dom: 19.2.4([email protected])- optionalDependencies:- '@types/react': 19.2.14- '@types/react-dom': 19.2.3(@types/[email protected])-'@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':dependencies:'@radix-ui/primitive': 1.1.3diff --git a/web/package.json b/web/package.jsonindex d65d2afabc..f89fa5c53e 100644--- a/web/package.json+++ b/web/package.json@@ -95,7 +95,6 @@"@radix-ui/react-switch": "^1.3.7","@radix-ui/react-tabs": "^1.1.13","@radix-ui/react-toggle": "^1.1.10",- "@radix-ui/react-toggle-group": "^1.1.11","@radix-ui/react-tooltip": "^1.2.8","@scalar/api-reference": "1.66.1","@sentry/nextjs": "^10.64.0",diff --git a/web/src/components/design-system/Tabs/Tabs.tsx b/web/src/components/design-system/Tabs/Tabs.tsxindex 17abe15bd2..f807c3b07b 100644--- a/web/src/components/design-system/Tabs/Tabs.tsx+++ b/web/src/components/design-system/Tabs/Tabs.tsx@@ -79,6 +79,8 @@ const tabsTriggerVariants = cva();type TabsRootProps = {+ /** `manual`: arrow keys only move focus; Enter/Space selects. For form inputs where a focus must not commit a value. */+ activationMode?: "automatic" | "manual";children: React.ReactNode;/** `fill`: a column that takes its flex parent's remaining height, for `Tabs.Content layout="fill"`. */layout?: "fill";@@ -92,6 +94,7 @@ type TabsRootProps = {const TabsRootContext = React.createContext(false);function TabsRoot({+ activationMode,children,defaultValue,layout,@@ -102,6 +105,7 @@ function TabsRoot({return (<TabsRootContext value={true}><TabsPrimitive.Root+ activationMode={activationMode}className={layout === "fill" ? rootFillClassName : undefined}defaultValue={defaultValue}onValueChange={onValueChange}diff --git a/web/src/components/ui/toggle-group.tsx b/web/src/components/ui/toggle-group.tsxdeleted file mode 100644index e5c353a124..0000000000--- a/web/src/components/ui/toggle-group.tsx+++ /dev/null@@ -1,84 +0,0 @@-/* eslint-disable @repo/no-style-props */-"use client";--import * as React from "react";-import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";-import { cva, type VariantProps } from "class-variance-authority";-import { cn } from "@/src/utils/tailwind";--const toggleGroupItemVariants = cva(- "inline-flex items-center justify-center rounded-md font-bold ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",- {- variants: {- variant: {- default:- "bg-transparent text-foreground hover:bg-muted hover:text-muted-foreground data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",- outline:- "border border-input bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",- },- size: {- default: "h-8 px-3 text-sm",- xs: "h-6 px-1.5 text-sm",- sm: "h-9 px-2.5 text-sm",- lg: "h-11 px-5 text-sm",- },- },- defaultVariants: {- variant: "default",- size: "default",- },- },-);--const ToggleGroupContext = React.createContext<- VariantProps<typeof toggleGroupItemVariants>->({- size: "default",- variant: "default",-});--const ToggleGroup = React.forwardRef<- React.ComponentRef<typeof ToggleGroupPrimitive.Root>,- React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &- VariantProps<typeof toggleGroupItemVariants>->(({ className, variant, size, children, ...props }, ref) => (- <ToggleGroupPrimitive.Root- ref={ref}- className={cn("flex items-center justify-center gap-1", className)}- {...props}- >- <ToggleGroupContext.Provider value={{ variant, size }}>- {children}- </ToggleGroupContext.Provider>- </ToggleGroupPrimitive.Root>-));--ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;--const ToggleGroupItem = React.forwardRef<- React.ComponentRef<typeof ToggleGroupPrimitive.Item>,- React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &- VariantProps<typeof toggleGroupItemVariants>->(({ className, children, variant, size, ...props }, ref) => {- const context = React.useContext(ToggleGroupContext);-- return (- <ToggleGroupPrimitive.Item- ref={ref}- className={cn(- toggleGroupItemVariants({- variant: context.variant || variant,- size: context.size || size,- }),- className,- )}- {...props}- >- {children}- </ToggleGroupPrimitive.Item>- );-});--ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;--export { ToggleGroup, ToggleGroupItem };diff --git a/web/src/features/chart-view/components/ChartViewPanel.tsx b/web/src/features/chart-view/components/ChartViewPanel.tsxindex 353acf25d4..ec594d6e4a 100644--- a/web/src/features/chart-view/components/ChartViewPanel.tsx+++ b/web/src/features/chart-view/components/ChartViewPanel.tsx@@ -133,7 +133,7 @@ export const ChartViewPanel = React.memo(function ChartViewPanel({<ChartTypePickervalue={config.chartType}onChange={onChartType}- showLabels+ layout="full"/></PanelField><PanelField label="Metric">diff --git a/web/src/features/chart-view/components/ConfigControls.tsx b/web/src/features/chart-view/components/ConfigControls.tsxindex 5f88727793..d9a0714071 100644--- a/web/src/features/chart-view/components/ConfigControls.tsx+++ b/web/src/features/chart-view/components/ConfigControls.tsx@@ -7,13 +7,12 @@ import {SelectTrigger,SelectValue,} from "@/src/components/ui/select";-import { ToggleGroup, ToggleGroupItem } from "@/src/components/ui/toggle-group";import {Tooltip,TooltipContent,TooltipTrigger,} from "@/src/components/ui/tooltip";-import { cn } from "@/src/utils/tailwind";+import { Tabs } from "@/src/components/design-system/Tabs/Tabs";import {type AggregationFn,type DimensionKey,@@ -145,49 +144,42 @@ export const GranularitySelect = React.memo(function GranularitySelect({export const ChartTypePicker = React.memo(function ChartTypePicker({value,onChange,- showLabels = false,+ layout,}: {value: DashboardWidgetChartType;onChange: (value: DashboardWidgetChartType) => void;- showLabels?: boolean;+ /** `full`: stretch across the host, one equal column per chart type. */+ layout?: "full";}) {return (- <ToggleGroup- type="single"+ <Tabs+ activationMode="manual"value={value}- onValueChange={(v) => {- if (v) onChange(v as DashboardWidgetChartType);- }}- variant="outline"- className={cn(showLabels ? "grid grid-cols-3 gap-1" : "gap-0.5")}+ onValueChange={(v) => onChange(v as DashboardWidgetChartType)}>- {CHART_TYPES.map((ct) => {- const Icon = ct.icon;- const item = (- <ToggleGroupItem- key={ct.value}- value={ct.value}- size={showLabels ? "default" : "xs"}- aria-label={ct.label}- className={cn(- showLabels- ? "flex h-auto flex-col gap-1 py-2 text-[11px]"- : "h-7 w-7 p-0",- )}- >- <Icon className={showLabels ? "icon-base" : "icon-base"} />- {showLabels ? <span>{ct.label}</span> : null}- </ToggleGroupItem>- );-- if (showLabels) return item;- return (- <Tooltip key={ct.value}>- <TooltipTrigger asChild>{item}</TooltipTrigger>- <TooltipContent>{ct.label}</TooltipContent>- </Tooltip>- );- })}- </ToggleGroup>+ <Tabs.List+ variant="inset"+ size="md"+ layout={layout}+ aria-label="Chart type"+ >+ {CHART_TYPES.map((ct) => {+ const Icon = ct.icon;+ return (+ <Tooltip key={ct.value}>+ <TooltipTrigger asChild>+ <span className="h-full min-w-0">+ <Tabs.Trigger value={ct.value}>+ <Icon aria-hidden="true" className="icon-base shrink-0" />+ <span className="sr-only">{ct.label}</span>+ </Tabs.Trigger>+ </span>+ </TooltipTrigger>+ <TooltipContent>{ct.label}</TooltipContent>+ </Tooltip>+ );+ })}+ </Tabs.List>+ </Tabs>);});diff --git a/web/src/features/chart-view/components/ViewModeToggle.tsx b/web/src/features/chart-view/components/ViewModeToggle.tsxindex 20ab7bbc48..6da7df90ce 100644--- a/web/src/features/chart-view/components/ViewModeToggle.tsx+++ b/web/src/features/chart-view/components/ViewModeToggle.tsx@@ -1,6 +1,6 @@import React from "react";import { BarChart3, Table } from "lucide-react";-import { ToggleGroup, ToggleGroupItem } from "@/src/components/ui/toggle-group";+import { Tabs } from "@/src/components/design-system/Tabs/Tabs";import { type ViewMode } from "../types";/**@@ -15,34 +15,18 @@ export const ViewModeToggle = React.memo(function ViewModeToggle({onModeChange: (mode: ViewMode) => void;}) {return (- <ToggleGroup- type="single"- value={mode}- onValueChange={(v) => {- if (v) onModeChange(v as ViewMode);- }}- variant="outline"- // Match the h-8 height of the sibling toolbar controls (preset chips, My- // Views, Columns). The view-mode switch is conceptually separate from the- // filter presets to its left, so give it a margin bump off that cluster.- className="ml-1 gap-0"- >- <ToggleGroupItem- value="table"- aria-label="Table view"- className="h-8 gap-1.5 rounded-r-none px-2.5 text-xs"+ // Offset from the filter-preset cluster to its left.+ <div className="ml-1">+ <Tabs+ activationMode="manual"+ value={mode}+ onValueChange={(v) => onModeChange(v as ViewMode)}>- <Table className="icon-base" />- Table- </ToggleGroupItem>- <ToggleGroupItem- value="chart"- aria-label="Chart view"- className="h-8 gap-1.5 rounded-l-none border-l-0 px-2.5 text-xs"- >- <BarChart3 className="icon-base" />- Chart- </ToggleGroupItem>- </ToggleGroup>+ <Tabs.List variant="inset" size="md" aria-label="View mode">+ <Tabs.Trigger value="table" icon={Table} label="Table" />+ <Tabs.Trigger value="chart" icon={BarChart3} label="Chart" />+ </Tabs.List>+ </Tabs>+ </div>);});diff --git a/web/src/features/scores-chart-view/components/ScoreChartViewPanel/ScoreChartViewPanel.tsx b/web/src/features/scores-chart-view/components/ScoreChartViewPanel/ScoreChartViewPanel.tsxindex 8b3c912604..8a67742675 100644--- a/web/src/features/scores-chart-view/components/ScoreChartViewPanel/ScoreChartViewPanel.tsx+++ b/web/src/features/scores-chart-view/components/ScoreChartViewPanel/ScoreChartViewPanel.tsx@@ -132,7 +132,7 @@ export const ScoreChartViewPanel = React.memo(function ScoreChartViewPanel({<ChartTypePickervalue={config.chartType}onChange={onChartType}- showLabels+ layout="full"/></PanelField><PanelField label="View">diff --git a/web/src/features/scores/components/CategoricalScoreInput.tsx b/web/src/features/scores/components/CategoricalScoreInput.tsxindex 48b71876a6..746d24776c 100644--- a/web/src/features/scores/components/CategoricalScoreInput.tsx+++ b/web/src/features/scores/components/CategoricalScoreInput.tsx@@ -7,7 +7,7 @@ import {import { Button } from "@/src/components/ui/button";import { Combobox } from "@/src/components/ui/combobox";import { KeyboardShortcut } from "@/src/components/design-system/KeyboardShortcut/KeyboardShortcut";-import { ToggleGroup, ToggleGroupItem } from "@/src/components/ui/toggle-group";+import { Tabs } from "@/src/components/design-system/Tabs/Tabs";import { useHasProjectAccess } from "@/src/features/rbac";import { isCategoricalDataType } from "@/src/features/scores/lib/helpers";import { getAddCategoryActionLabel } from "@/src/features/scores/lib/annotationFormHelpers";@@ -103,57 +103,50 @@ export function CategoricalScoreInput({/>) : (<div className="flex items-center gap-1">- <ToggleGroup- type="single"- // Horizontal roving so Radix only uses- // ←/→ between True/False, leaving ↑/↓ for- // our field navigation (no double-handling).- orientation="horizontal"- value={value}- disabled={disabled}- className={`grid flex-1 grid-cols-${categories.length}`}- onValueChange={onValueChange}- >- {categories.map((category) =>- category.isOutdated ? (- <ToggleGroupItem- key={category.value}- value={category.label}- disabled- variant="outline"- className="grid grid-flow-col gap-1 px-1 text-xs font-normal text-nowrap opacity-50"- >- <span className="truncate" title={category.label}>- {category.label}- </span>- <span>{`(${category.value})`}</span>- </ToggleGroupItem>- ) : (- <ToggleGroupItem- key={category.value}- value={category.label}- variant="outline"- className="grid grid-flow-col gap-1 px-1 text-xs font-normal text-nowrap"- >- <span className="truncate" title={category.label}>- {category.label}- </span>- {(() => {- const categoryIndex =- config.categories?.findIndex(- (c) => c.label === category.label,- ) ?? -1;- const digitShortcut = DIGIT_SHORTCUTS[categoryIndex];- return digitShortcut ? (- <span className="ml-0.5 hidden md:group-focus-within:inline-flex">- <KeyboardShortcut size="xs" keys={[digitShortcut]} />+ <div className="min-w-0 flex-1">+ {/* Manual activation: ←/→ only move focus, Enter/Space picks. ↑/↓ stay with the form's row navigation. */}+ <Tabs+ value={value}+ onValueChange={onValueChange}+ activationMode="manual"+ >+ <Tabs.List+ variant="inset"+ size="md"+ layout="full"+ aria-label={config.name}+ >+ {categories.map((category) => {+ const categoryIndex =+ config.categories?.findIndex(+ (c) => c.label === category.label,+ ) ?? -1;+ const digitShortcut = category.isOutdated+ ? undefined+ : DIGIT_SHORTCUTS[categoryIndex];+ return (+ <Tabs.Trigger+ key={category.value}+ value={category.label}+ disabled={disabled || category.isOutdated}+ >+ <span className="min-w-0 truncate" title={category.label}>+ {category.label}</span>- ) : null;- })()}- </ToggleGroupItem>- ),- )}- </ToggleGroup>+ {category.isOutdated ? (+ <span>{`(${category.value})`}</span>+ ) : null}+ {digitShortcut ? (+ <span className="hidden md:group-focus-within:inline-flex">+ <KeyboardShortcut size="xs" keys={[digitShortcut]} />+ </span>+ ) : null}+ </Tabs.Trigger>+ );+ })}+ </Tabs.List>+ </Tabs>+ </div>{canAddCategory ? (<Buttontype="button"diff --git a/web/src/features/scores/components/DualAnnotationContent.clienttest.tsx b/web/src/features/scores/components/DualAnnotationContent.clienttest.tsxindex e0663be254..b0caa23d2e 100644--- a/web/src/features/scores/components/DualAnnotationContent.clienttest.tsx+++ b/web/src/features/scores/components/DualAnnotationContent.clienttest.tsx@@ -479,13 +479,14 @@ describe("unified annotation targets", () => {);expect(within(screen.getByRole("group", { name: "Quality (Trace)" })).getByRole(- "radio",+ "tab",{ name: /True/ },),- ).toHaveAttribute("aria-checked", "true");- expect(- within(quality).getByRole("radio", { name: /True/ }),- ).toHaveAttribute("aria-checked", "true");+ ).toHaveAttribute("aria-selected", "true");+ expect(within(quality).getByRole("tab", { name: /True/ })).toHaveAttribute(+ "aria-selected",+ "true",+ );expect(feedback).toHaveValue("Unsent feedback");expect(comment).toHaveValue("Unsent score comment");expect(mocks.create).not.toHaveBeenCalled();@@ -527,28 +528,28 @@ describe("unified annotation targets", () => {companionTrace: { environment: "default", scores: [] },}),);- fireEvent.click(within(row).getByRole("radio", { name: /True/ }));+ fireEvent.mouseDown(within(row).getByRole("tab", { name: /True/ }));await waitFor(() => expect(mocks.update).toHaveBeenCalledOnce());refresh(0);- expect(within(row).getByRole("radio", { name: /True/ })).toHaveAttribute(- "aria-checked",+ expect(within(row).getByRole("tab", { name: /True/ })).toHaveAttribute(+ "aria-selected","true",);await act(async () => pending.resolve({}));refresh(0);- expect(within(row).getByRole("radio", { name: /True/ })).toHaveAttribute(- "aria-checked",+ expect(within(row).getByRole("tab", { name: /True/ })).toHaveAttribute(+ "aria-selected","true",);refresh(1);refresh(0);- expect(within(row).getByRole("radio", { name: /False/ })).toHaveAttribute(- "aria-checked",+ expect(within(row).getByRole("tab", { name: /False/ })).toHaveAttribute(+ "aria-selected","true",);refresh(0, false);- expect(within(row).getByRole("radio", { name: /False/ })).toHaveAttribute(- "aria-checked",+ expect(within(row).getByRole("tab", { name: /False/ })).toHaveAttribute(+ "aria-selected","false",);expect(mocks.update).toHaveBeenCalledOnce();@@ -578,16 +579,29 @@ describe("unified annotation targets", () => {).not.toBeInTheDocument();refresh(1);- expect(screen.getByRole("radio", { name: /True/ })).toHaveAttribute(- "aria-checked",+ expect(screen.getByRole("tab", { name: /True/ })).toHaveAttribute(+ "aria-selected","true",);});+ it("moves between categories with arrow keys and saves only on Enter", async () => {+ mocks.create.mockResolvedValue({});+ renderContent();+ const trueTab = screen.getByRole("tab", { name: /True/ });+ const falseTab = screen.getByRole("tab", { name: /False/ });+ act(() => trueTab.focus());+ fireEvent.keyDown(trueTab, { key: "ArrowRight" });+ await waitFor(() => expect(falseTab).toHaveFocus());+ expect(mocks.create).not.toHaveBeenCalled();+ fireEvent.keyDown(falseTab, { key: "Enter" });+ await waitFor(() => expect(mocks.create).toHaveBeenCalledOnce());+ });+it("hides the score comment portal without losing its unsaved draft", async () => {mocks.create.mockResolvedValue({});const rendered = renderContent();- fireEvent.click(screen.getByRole("radio", { name: /True/ }));+ fireEvent.mouseDown(screen.getByRole("tab", { name: /True/ }));await waitFor(() =>expect(screen.getByRole("status", { name: "Score save status" }),@@ -613,7 +627,7 @@ describe("unified annotation targets", () => {try {mocks.create.mockResolvedValue({});renderContent();- fireEvent.click(screen.getByRole("radio", { name: /True/ }));+ fireEvent.mouseDown(screen.getByRole("tab", { name: /True/ }));await waitFor(() =>expect(screen.getByRole("status", { name: "Score save status" }),@@ -688,7 +702,7 @@ describe("unified annotation targets", () => {targetType: "trace",dataType: "BOOLEAN",});- fireEvent.click(screen.getByRole("radio", { name: /True/ }));+ fireEvent.mouseDown(screen.getByRole("tab", { name: /True/ }));await waitFor(() =>expect(mocks.create).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({@@ -724,11 +738,12 @@ describe("unified annotation targets", () => {});const traceRow = screen.getByRole("group", { name: "Quality (Trace)" });expect(- within(observationRow).getByRole("radio", { name: /True/ }),- ).toHaveAttribute("aria-checked", "false");- expect(- within(traceRow).getByRole("radio", { name: /True/ }),- ).toHaveAttribute("aria-checked", "true");+ within(observationRow).getByRole("tab", { name: /True/ }),+ ).toHaveAttribute("aria-selected", "false");+ expect(within(traceRow).getByRole("tab", { name: /True/ })).toHaveAttribute(+ "aria-selected",+ "true",+ );fireEvent.keyDown(within(traceRow).getByRole("button", { name: /Score actions/ }),{ key: "ArrowDown" },@@ -909,11 +924,12 @@ describe("unified annotation targets", () => {]),);expect(- within(observationRow).getByRole("radio", { name: /False/ }),- ).toHaveAttribute("aria-checked", "true");- expect(- within(traceRow).getByRole("radio", { name: /True/ }),- ).toHaveAttribute("aria-checked", "true");+ within(observationRow).getByRole("tab", { name: /False/ }),+ ).toHaveAttribute("aria-selected", "true");+ expect(within(traceRow).getByRole("tab", { name: /True/ })).toHaveAttribute(+ "aria-selected",+ "true",+ );});it("restores a categorical score after a failed clear and keeps its field after retry", async () => {@@ -969,8 +985,8 @@ describe("unified annotation targets", () => {name: "Quality (Observation)",});expect(- within(restored).getByRole("radio", { name: /False/ }),- ).toHaveAttribute("aria-checked", "true");+ within(restored).getByRole("tab", { name: /False/ }),+ ).toHaveAttribute("aria-selected", "true");fireEvent.keyDown(screen.getByRole("button", {name: "Score actions for Quality (Observation)",@@ -991,12 +1007,14 @@ describe("unified annotation targets", () => {const cleared = screen.getByRole("group", {name: "Quality (Observation)",});- expect(- within(cleared).getByRole("radio", { name: /False/ }),- ).toHaveAttribute("aria-checked", "false");- expect(- within(traceRow).getByRole("radio", { name: /True/ }),- ).toHaveAttribute("aria-checked", "true");+ expect(within(cleared).getByRole("tab", { name: /False/ })).toHaveAttribute(+ "aria-selected",+ "false",+ );+ expect(within(traceRow).getByRole("tab", { name: /True/ })).toHaveAttribute(+ "aria-selected",+ "true",+ );fireEvent.keyDown(screen.getByRole("button", {name: "Score actions for Quality (Observation)",@@ -1019,22 +1037,22 @@ describe("unified annotation targets", () => {.mockReturnValueOnce(newer.promise);renderContent();const row = screen.getByRole("group", { name: "Quality" });- fireEvent.click(within(row).getByRole("radio", { name: /False/ }));+ fireEvent.mouseDown(within(row).getByRole("tab", { name: /False/ }));await waitFor(() =>expect(screen.getByRole("status", { name: "Score save status" }),).toHaveTextContent("Saved"),);- fireEvent.click(within(row).getByRole("radio", { name: /True/ }));- fireEvent.click(within(row).getByRole("radio", { name: /False/ }));+ fireEvent.mouseDown(within(row).getByRole("tab", { name: /True/ }));+ fireEvent.mouseDown(within(row).getByRole("tab", { name: /False/ }));await waitFor(() => expect(mocks.update).toHaveBeenCalledTimes(2));await act(async () => newer.resolve({}));await act(async () => older.reject(new Error("Earlier edit failed")));expect(screen.getByRole("status", { name: "Score save status" }),).toHaveTextContent("Saved");- expect(within(row).getByRole("radio", { name: /False/ })).toHaveAttribute(- "aria-checked",+ expect(within(row).getByRole("tab", { name: /False/ })).toHaveAttribute(+ "aria-selected","true",);});@@ -1056,10 +1074,10 @@ describe("unified annotation targets", () => {name: "Quality (Observation)",});const traceRow = screen.getByRole("group", { name: "Quality (Trace)" });- fireEvent.click(- within(observationRow).getByRole("radio", { name: /False/ }),+ fireEvent.mouseDown(+ within(observationRow).getByRole("tab", { name: /False/ }),);- fireEvent.click(within(traceRow).getByRole("radio", { name: /True/ }));+ fireEvent.mouseDown(within(traceRow).getByRole("tab", { name: /True/ }));await waitFor(() => expect(mocks.create).toHaveBeenCalledTimes(2));expect(screen.getByRole("status", { name: "Score save status" }),@@ -1074,11 +1092,11 @@ describe("unified annotation targets", () => {).toHaveTextContent(retryWhilePending ? "Saving" : "Could not save"),);expect(- within(observationRow).getByRole("radio", { name: /False/ }),- ).toHaveAttribute("aria-checked", "false");+ within(observationRow).getByRole("tab", { name: /False/ }),+ ).toHaveAttribute("aria-selected", "false");expect(- within(traceRow).getByRole("radio", { name: /True/ }),- ).toHaveAttribute("aria-checked", "true");+ within(traceRow).getByRole("tab", { name: /True/ }),+ ).toHaveAttribute("aria-selected", "true");act(() => observationRow.focus());fireEvent.keyDown(observationRow, { key: "1" });await waitFor(() => expect(mocks.create).toHaveBeenCalledTimes(3));@@ -1096,9 +1114,9 @@ describe("unified annotation targets", () => {const pending = deferred();mocks.create.mockReturnValueOnce(pending.promise).mockResolvedValue({});await renderBothTargets();- fireEvent.click(+ fireEvent.mouseDown(within(screen.getByRole("group", { name: "Quality (Trace)" })).getByRole(- "radio",+ "tab",{ name: /True/ },),);@@ -1115,10 +1133,10 @@ describe("unified annotation targets", () => {await act(async () => pending.reject(new Error("Trace save failed")));const remaining = screen.getByRole("group", { name: "Quality" });expect(- within(remaining).getByRole("radio", { name: /True/ }),- ).toHaveAttribute("aria-checked", "false");+ within(remaining).getByRole("tab", { name: /True/ }),+ ).toHaveAttribute("aria-selected", "false");expect(within(remaining).getByText("Failed to create score")).toBeVisible();- fireEvent.click(within(remaining).getByRole("radio", { name: /False/ }));+ fireEvent.mouseDown(within(remaining).getByRole("tab", { name: /False/ }));await waitFor(() => expect(mocks.create).toHaveBeenCalledTimes(2));expect(mocks.create).toHaveBeenLastCalledWith(expect.objectContaining({