Skip to content

Commit a644948

Browse files
DylanMerigaudclaude
andcommitted
Drop trace auto-scroll; keep the "more" affordance
The trace reads top-down like a log with the key info (document, extraction, first steps) at the top, so jumping to the bottom hid what the user just ran. Now the scroll stays put; "more ↓" signals there's content below to read at the user's own pace. A fresh run resets to the top. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 198d19f commit a644948

1 file changed

Lines changed: 8 additions & 22 deletions

File tree

components/dashboard.tsx

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -102,42 +102,28 @@ export function Dashboard({ queue }: { queue: QueueItem[] }) {
102102
const listRef = useRef<HTMLUListElement | null>(null);
103103
const [scroll, setScroll] = useState({ hiddenBelow: 0, atBottom: true });
104104

105-
// Right pane (trace) scroll: follow new content to the bottom by default, but
106-
// STOP as soon as the user scrolls up to read — and resume if they scroll back
107-
// to the bottom. (Same behaviour as a terminal/log view.)
105+
// Right pane (trace) scroll. The trace reads top-down like a log and the key
106+
// info (document, extraction, first steps) is at the top, so we DON'T auto-
107+
// scroll — the user keeps their place and the "more ↓" affordance signals
108+
// there's content below to scroll to at their own pace.
108109
const traceScrollRef = useRef<HTMLDivElement | null>(null);
109-
const autoFollowRef = useRef(true);
110110
const [traceMore, setTraceMore] = useState(false);
111111

112112
function measureTrace() {
113113
const el = traceScrollRef.current;
114114
if (!el) return;
115115
const remaining = el.scrollHeight - el.clientHeight - el.scrollTop;
116-
// User is "at the bottom" within a small slack → (re)enable auto-follow.
117-
autoFollowRef.current = remaining < 8;
118116
setTraceMore(remaining > 24);
119117
}
120118

121119
useEffect(() => {
122120
const el = traceScrollRef.current;
123121
if (!el) return;
124-
// In the idle PDF preview there's no trace to follow — leave the scroll at the
125-
// top (show the top of the document), and don't flag "more".
126-
if (state.status === "idle") {
127-
el.scrollTop = 0;
128-
setTraceMore(false);
129-
autoFollowRef.current = true; // re-arm for the next run
130-
return;
131-
}
132-
// A fresh run (trace just reset) re-arms auto-follow, even if the user had
133-
// scrolled up during the previous run.
134-
if (state.trace.length <= 1) autoFollowRef.current = true;
135-
if (autoFollowRef.current) {
136-
el.scrollTop = el.scrollHeight;
137-
}
138-
// Recompute the "more ↓" affordance after content changes.
122+
// A fresh run resets the scroll to the top (start of the trace); otherwise
123+
// leave the user's position alone.
124+
if (state.status === "idle" || state.trace.length <= 1) el.scrollTop = 0;
139125
const remaining = el.scrollHeight - el.clientHeight - el.scrollTop;
140-
setTraceMore(remaining > 24);
126+
setTraceMore(state.status !== "idle" && remaining > 24);
141127
}, [state.trace, state.status]);
142128

143129
function measureScroll() {

0 commit comments

Comments
 (0)