Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: horizontally scroll long API usage examples (#14798)

Nilay4b24a9a045d2
diff --git a/studio/frontend/src/features/settings/components/usage-examples.tsx b/studio/frontend/src/features/settings/components/usage-examples.tsx
index 18b8e62d898..70b010350e7 100644
--- a/studio/frontend/src/features/settings/components/usage-examples.tsx
+++ b/studio/frontend/src/features/settings/components/usage-examples.tsx
@@ -566,12 +566,13 @@ export function HighlightedCode({
[code, language],
);
return (
+ // Intrinsic code width keeps scrolling on the focusable section.
<section
// Safari never focuses a scroller on its own, so long examples need a tab stop.
// biome-ignore lint/a11y/noNoninteractiveTabindex: keyboard-scrollable region
tabIndex={0}
aria-label={label}
- className="max-h-96 max-w-full overflow-auto scroll-rounded rounded-lg p-3 pr-16 outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset text-ui-11 leading-relaxed [&_pre]:!m-0 [&_pre]:!whitespace-pre-wrap [&_pre]:!break-words [&_pre]:!border-0 [&_pre]:!bg-transparent [&_pre]:!p-0 [&_pre]:!text-ui-11 [&_pre]:!leading-relaxed [&_code]:!text-ui-11 [&_[data-streamdown=code-block]]:!my-0 [&_[data-streamdown=code-block]]:!border-0 [&_[data-streamdown=code-block]]:!bg-transparent [&_[data-streamdown=code-block]]:!p-0 [&_[data-streamdown=code-block]]:!text-ui-11"
+ className="max-h-96 max-w-full overflow-auto scroll-rounded rounded-lg p-3 pr-16 outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset text-ui-11 leading-relaxed [&_pre]:!m-0 [&_pre]:!whitespace-pre [&_pre]:!break-normal [&_pre]:!border-0 [&_pre]:!bg-transparent [&_pre]:!p-0 [&_pre]:!text-ui-11 [&_pre]:!leading-relaxed [&_code]:!text-ui-11 [&_[data-streamdown=code-block]]:!min-w-max [&_[data-streamdown=code-block]]:!my-0 [&_[data-streamdown=code-block]]:!border-0 [&_[data-streamdown=code-block]]:!bg-transparent [&_[data-streamdown=code-block]]:!p-0 [&_[data-streamdown=code-block]]:!text-ui-11"
data-reload-snapshot-sensitive={redactFromReload ? "" : undefined}
>
<Streamdown
diff --git a/studio/frontend/tests/settings-code-boxes.test.ts b/studio/frontend/tests/settings-code-boxes.test.ts
index d141431571c..4973bc394b5 100644
--- a/studio/frontend/tests/settings-code-boxes.test.ts
+++ b/studio/frontend/tests/settings-code-boxes.test.ts
@@ -42,6 +42,12 @@ test("long API examples are capped and scroll inside a keyboard-reachable region
highlightedCode,
/aria-label=\{label\}[\s\S]*data-reload-snapshot-sensitive=\{redactFromReload \? "" : undefined\}/,
);
+ // wrapped lines broke mid-token and ran back to the line-number gutter
+ const cls =
+ highlightedCode.match(/<section[\s\S]*?className="([^"]+)"/)?.[1] ?? "";
+ assert.match(cls, /\[&_pre\]:!whitespace-pre(?!-)/);
+ assert.doesNotMatch(cls, /break-words|break-all|whitespace-pre-wrap/);
+ assert.match(cls, /\[&_\[data-streamdown=code-block\]\]:!min-w-max\b/);
for (const caller of [USAGE, AUDIO]) {
assert.match(
caller,