🪢 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): expand the v4 delay badge hover text to its full width (#16065)
Trang Nguyen4422550a3506
diff --git a/web/src/features/v4-migration/V4MigrationBadgeContent.stories.tsx b/web/src/features/v4-migration/V4MigrationBadgeContent.stories.tsxnew file mode 100644index 0000000000..453a72ccbf--- /dev/null+++ b/web/src/features/v4-migration/V4MigrationBadgeContent.stories.tsx@@ -0,0 +1,65 @@+import { expect, fn, userEvent, waitFor, within } from "storybook/test";++import preview from "../../../.storybook/preview";+import { V4MigrationBadgeContent } from "./V4MigrationBadgeContent";++// The longest copy the delay badge renders (V4MigrationDelayBadge); the+// hover reveal must expand to whatever width this needs (LF-90).+const OTEL_DESCRIPTION =+ "Your setup is outdated. Update OTel instrumentation for real-time data";++const meta = preview.meta({+ component: V4MigrationBadgeContent,+});++export const Default = meta.story({+ args: {+ onClick: fn(),+ title: "New data in ~15 min",+ description: "Your setup is outdated. Update SDK for real-time data",+ },+});++export const LongestDescription = meta.story({+ args: {+ onClick: fn(),+ title: "New data in ~15 min",+ description: OTEL_DESCRIPTION,+ },+});++export const Compact = meta.story({+ args: {+ onClick: fn(),+ title: "Action required",+ compact: true,+ },+});++export const TestFocusRevealsLongestDescription = meta.story({+ name: "(Test) Focus Reveals Longest Description",+ args: {+ onClick: fn(),+ title: "New data in ~15 min",+ description: OTEL_DESCRIPTION,+ },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const button = await canvas.findByRole("button");+ // Synthetic hover cannot activate CSS :hover; the badge also reveals on+ // focus-visible, which keyboard focus does trigger.+ await userEvent.tab();+ await expect(button).toHaveFocus();+ // The description sits in an overflow-hidden wrapper that animates open;+ // once expanded it must fit the whole text (no clipping mid-word).+ const text = within(button).getByText(+ /Update OTel instrumentation for real-time data/,+ );+ const clipBox = text.parentElement;+ if (!clipBox) throw new Error("description wrapper not found");+ await waitFor(() => {+ expect(clipBox.clientWidth).toBeGreaterThan(0);+ expect(clipBox.scrollWidth).toBeLessThanOrEqual(clipBox.clientWidth + 1);+ });+ },+});diff --git a/web/src/features/v4-migration/V4MigrationBadgeContent.tsx b/web/src/features/v4-migration/V4MigrationBadgeContent.tsxindex 8e1aefcc9a..eef5389721 100644--- a/web/src/features/v4-migration/V4MigrationBadgeContent.tsx+++ b/web/src/features/v4-migration/V4MigrationBadgeContent.tsx@@ -79,8 +79,12 @@ export function V4MigrationBadgeContent({<span className="flex items-center">{title}{description ? (- <span className="flex max-w-0 items-center overflow-hidden transition-[max-width] duration-300 ease-out group-hover:max-w-96 group-focus-visible:max-w-96">- <span className="whitespace-nowrap">. {description}.</span>+ // 0fr -> 1fr animates to the intrinsic text width; a max-width cap+ // would clip any description longer than the magic number (LF-90).+ <span className="grid grid-cols-[0fr] transition-[grid-template-columns] duration-300 ease-out group-hover:grid-cols-[1fr] group-focus-visible:grid-cols-[1fr]">+ <span className="min-w-0 overflow-hidden">+ <span className="whitespace-nowrap">. {description}.</span>+ </span></span>) : null}{showChevron ? (