Skip to content

Commit 470e9aa

Browse files
committed
feat: no-auto scroll on visual steps
1 parent d2ae359 commit 470e9aa

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎apps/web/src/components/NotebookCells.tsx‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ function CodeCell({
228228
const monacoRef = useRef<MonacoEditor.IStandaloneCodeEditor | null>(null);
229229
const decorationsRef = useRef<MonacoEditor.IEditorDecorationsCollection | null>(null);
230230

231-
// Mark the statement the visualization is showing and bring it into view
231+
// Mark the statement the visualization is showing (without scrolling to it)
232232
useEffect(() => {
233233
const editor = monacoRef.current;
234234
if (!editor) return;
@@ -241,8 +241,7 @@ function CodeCell({
241241
range: { startLineNumber: highlightLines.start, startColumn: 1, endLineNumber: highlightLines.end, endColumn: 1 },
242242
options: { isWholeLine: true, className: 'trace-line', linesDecorationsClassName: 'trace-line-gutter' },
243243
}]);
244-
editor.revealLinesInCenterIfOutsideViewport(highlightLines.start, highlightLines.end);
245-
wrapperRef.current?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
244+
// Highlight only: no scrolling, so stepping through the visualization never moves the reader
246245
}, [highlightLines]);
247246
// Keep the latest callback reachable from the Monaco listener registered once on mount
248247
const editFocusRef = useRef(onEditFocus);

0 commit comments

Comments
 (0)