Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(experiments): make a long output readable in place, and say that it scrolls (#17007)

Nikita Kabardin2de6a8000de6
diff --git a/web/src/components/design-system/table/components/IOTableCell/IOTableCell.tsx b/web/src/components/design-system/table/components/IOTableCell/IOTableCell.tsx
index d38af167ea..7e0dd57384 100644
--- a/web/src/components/design-system/table/components/IOTableCell/IOTableCell.tsx
+++ b/web/src/components/design-system/table/components/IOTableCell/IOTableCell.tsx
@@ -146,6 +146,10 @@ export const IOTableCell = memo(function IOTableCell({
? decodeUnicodeEscapesOnly(stringifiedJson, true)
: stringifiedJson;
+ // The multi-line branches scroll inside the cell, so their scrollport is
+ // marked `scrollbar-visible`: a region that scrolls without ever painting a
+ // scrollbar is indistinguishable from one whose content was cut off, and
+ // nobody reaches for the wheel on content they read as truncated.
let content: ReactNode;
if (singleLine) {
content = (
@@ -192,7 +196,10 @@ export const IOTableCell = memo(function IOTableCell({
"h-full w-full self-stretch overflow-hidden rounded-sm",
variantClassName,
)}
- codeClassName={cn("min-h-0 h-full overflow-y-auto", paddingClassName)}
+ codeClassName={cn(
+ "scrollbar-visible min-h-0 h-full overflow-y-auto",
+ paddingClassName,
+ )}
collapseStringsAfterLength={null}
borderless
/>
@@ -213,7 +220,10 @@ export const IOTableCell = memo(function IOTableCell({
"h-full w-full self-stretch overflow-hidden rounded-sm",
variantClassName,
)}
- codeClassName={cn("min-h-0 h-full overflow-y-auto", paddingClassName)}
+ codeClassName={cn(
+ "scrollbar-visible min-h-0 h-full overflow-y-auto",
+ paddingClassName,
+ )}
collapseStringsAfterLength={null}
borderless
/>
diff --git a/web/src/features/experiments/components/table/ExperimentGridCell.tsx b/web/src/features/experiments/components/table/ExperimentGridCell.tsx
index 5813bb5248..d58b515dac 100644
--- a/web/src/features/experiments/components/table/ExperimentGridCell.tsx
+++ b/web/src/features/experiments/components/table/ExperimentGridCell.tsx
@@ -856,8 +856,13 @@ export const ExperimentGridCell = ({
}))
.filter((section) => section.content !== null);
+ // The cell is the scrollport in this layout: the output section keeps its
+ // content's height as its base, so a long output makes the cell taller than
+ // the row and the reader scrolls the cell to reach the scores under it.
+ // `scrollbar-visible` is what says so — under the platform's overlay
+ // scrollbars a cell with more to show reads as one that was cut off.
return (
- <div className="flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-auto">
+ <div className="scrollbar-visible flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-auto">
{sectionsToRender.map((section, index) => {
const { row, content } = section;
const isFirst = index === 0;
diff --git a/web/src/features/experiments/components/table/ExperimentItemsTable.tsx b/web/src/features/experiments/components/table/ExperimentItemsTable.tsx
index 0fdcc12c02..480be676da 100644
--- a/web/src/features/experiments/components/table/ExperimentItemsTable.tsx
+++ b/web/src/features/experiments/components/table/ExperimentItemsTable.tsx
@@ -273,6 +273,12 @@ const StackedExperimentCell = ({
/**
* A single experiment's output within the stacked list cell. Renders the
* compact (truncated) output value from the list query.
+ *
+ * `h-full min-h-0` is what makes a long output scrollable rather than clipped:
+ * the IO cell inside sizes itself to its parent, so an auto-height row hands it
+ * the content's own height and the row's `overflow-hidden` then cuts it off
+ * with no way to read the rest. Bounded to the row, the IO cell's own
+ * scrollport takes over.
*/
const StackedOutputRow = ({
output,
@@ -287,7 +293,7 @@ const StackedOutputRow = ({
chip?: React.ReactNode;
}) => {
return (
- <div className="flex min-w-0 items-start">
+ <div className="flex h-full min-h-0 min-w-0 items-start">
<span
className={cn(
"mt-0.5 mr-2 block h-4 w-0.5 shrink-0 rounded-full",
@@ -376,7 +382,7 @@ const StackedOutputCell = ({
>
{showExpectedLine && (
<div className="flex min-h-0 items-start overflow-hidden py-0.5 pr-1 pl-1.5">
- <div className="flex min-w-0 items-start">
+ <div className="flex h-full min-h-0 min-w-0 items-start">
<span className="text-muted-foreground mt-0.5 mr-1 shrink-0 text-[10px] font-bold uppercase">
Exp
</span>
@@ -404,7 +410,7 @@ const StackedOutputCell = ({
className="flex min-h-0 items-start overflow-hidden py-0.5 pr-1 pl-1.5"
>
{isLoading ? (
- <div className="flex min-w-0 items-start">
+ <div className="flex h-full min-h-0 min-w-0 items-start">
<span className="bg-muted mt-0.5 mr-2 block h-4 w-0.5 shrink-0 rounded-full" />
<ConnectedIOTableCell isLoading singleLine={singleLine} />
</div>
diff --git a/web/src/styles/globals.css b/web/src/styles/globals.css
index 53b7a5eba2..f7874a8d16 100644
--- a/web/src/styles/globals.css
+++ b/web/src/styles/globals.css
@@ -726,6 +726,42 @@
}
}
+/* A scrollport that says so. Overlay scrollbars — the platform default on
+ macOS, and Chrome's default everywhere — paint nothing until a scroll is
+ already under way, so a region holding more than it shows is
+ indistinguishable from one whose content was truncated: the reader has no
+ reason to try the wheel. This paints a thin scrollbar whenever the content
+ overflows, and still nothing when it fits. `scrollbar-color` also opts
+ Firefox out of overlay scrollbars, which it uses by default too. */
+@utility scrollbar-visible {
+ &::-webkit-scrollbar {
+ width: 8px;
+ height: 8px;
+ }
+
+ &::-webkit-scrollbar-track {
+ background-color: transparent;
+ }
+
+ &::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: hsl(var(--muted-foreground) / 0.4);
+ }
+
+ &::-webkit-scrollbar-thumb:hover {
+ background-color: hsl(var(--muted-foreground) / 0.6);
+ }
+
+ /* Firefox has no `::-webkit-scrollbar`, so the standard properties are its
+ only way in — and they must NOT reach Chrome, where they take precedence
+ and switch the always-painted scrollbar above back off for an overlay one.
+ Hence the gate rather than declaring both unconditionally. */
+ @supports not selector(::-webkit-scrollbar) {
+ scrollbar-width: thin;
+ scrollbar-color: hsl(var(--muted-foreground) / 0.4) transparent;
+ }
+}
+
/* Tailwind's `sr-only` verbatim, plus `top: 0; left: 0`. Without them the box
sits at its static position, and since it is absolute, its containing block
is the nearest positioned ancestor — usually far outside the scroll container