Fix page scroll on row expand - use container scrollTop instead of scrollIntoView

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-02-02 02:14:49 +00:00
parent 6739a53fa8
commit d760638bf6

View File

@@ -51,10 +51,10 @@ export function DeploymentLogs({ deploymentUuid, status, initialLogs }: Deployme
} }
}, [initialLogs, fetchLogs]); }, [initialLogs, fetchLogs]);
// Auto-scroll to bottom when new logs arrive // Auto-scroll to bottom when new logs arrive (within container only)
useEffect(() => { useEffect(() => {
if (autoScroll && logsEndRef.current) { if (autoScroll && containerRef.current) {
logsEndRef.current.scrollIntoView({ behavior: 'smooth' }); containerRef.current.scrollTop = containerRef.current.scrollHeight;
} }
}, [logs, autoScroll]); }, [logs, autoScroll]);
@@ -141,7 +141,9 @@ export function DeploymentLogs({ deploymentUuid, status, initialLogs }: Deployme
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
setAutoScroll(true); setAutoScroll(true);
logsEndRef.current?.scrollIntoView({ behavior: 'smooth' }); if (containerRef.current) {
containerRef.current.scrollTop = containerRef.current.scrollHeight;
}
}} }}
className="absolute bottom-4 right-4 px-3 py-1.5 bg-slate-200 dark:bg-stone-800 text-slate-700 dark:text-stone-300 text-xs rounded-full shadow-lg hover:bg-slate-300 dark:hover:bg-stone-700 transition-colors" className="absolute bottom-4 right-4 px-3 py-1.5 bg-slate-200 dark:bg-stone-800 text-slate-700 dark:text-stone-300 text-xs rounded-full shadow-lg hover:bg-slate-300 dark:hover:bg-stone-700 transition-colors"
> >