diff --git a/frontends/pastebin/src/components/features/code-runner/CodeTerminal.tsx b/frontends/pastebin/src/components/features/code-runner/CodeTerminal.tsx index 24c59e26c..1461ace68 100644 --- a/frontends/pastebin/src/components/features/code-runner/CodeTerminal.tsx +++ b/frontends/pastebin/src/components/features/code-runner/CodeTerminal.tsx @@ -32,7 +32,13 @@ export function CodeTerminal({ language, files, entryPoint, controller }: CodeTe const terminalEndRef = useRef(null) useEffect(() => { - terminalEndRef.current?.scrollIntoView({ behavior: 'smooth' }) + const el = terminalEndRef.current + if (el) { + const container = el.closest('[data-testid="terminal-output-area"]') + if (container) { + container.scrollTop = container.scrollHeight + } + } }, [lines]) const hasErrors = lines.some((line) => line.type === 'error') diff --git a/frontends/pastebin/src/components/features/python-runner/PythonTerminal.tsx b/frontends/pastebin/src/components/features/python-runner/PythonTerminal.tsx index a3418755e..6d8a503cf 100644 --- a/frontends/pastebin/src/components/features/python-runner/PythonTerminal.tsx +++ b/frontends/pastebin/src/components/features/python-runner/PythonTerminal.tsx @@ -26,7 +26,13 @@ export function PythonTerminal({ code }: PythonTerminalProps) { const terminalEndRef = useRef(null) useEffect(() => { - terminalEndRef.current?.scrollIntoView({ behavior: 'smooth' }) + const el = terminalEndRef.current + if (el) { + const container = el.closest('[data-testid="terminal-output-area"]') + if (container) { + container.scrollTop = container.scrollHeight + } + } }, [lines]) // Determine if there are any errors in the output diff --git a/frontends/pastebin/src/components/features/snippet-display/SnippetCard.tsx b/frontends/pastebin/src/components/features/snippet-display/SnippetCard.tsx index 94b3e73d6..32dfd3bdd 100644 --- a/frontends/pastebin/src/components/features/snippet-display/SnippetCard.tsx +++ b/frontends/pastebin/src/components/features/snippet-display/SnippetCard.tsx @@ -142,7 +142,7 @@ export function SnippetCard({ return (