From e75f807fc6a56e4b28deba457a23d4e40758d1f0 Mon Sep 17 00:00:00 2001 From: snlavaise Date: Wed, 12 Aug 2026 03:38:19 +0000 Subject: [PATCH] fix: Prevenir desplazamiento de pagina al presionar Enter en terminal --- src/sections/SeccionSistema.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sections/SeccionSistema.tsx b/src/sections/SeccionSistema.tsx index 62fda2f..cf55135 100644 --- a/src/sections/SeccionSistema.tsx +++ b/src/sections/SeccionSistema.tsx @@ -12,12 +12,15 @@ export function SeccionSistema() { const [isExecuting, setIsExecuting] = useState(false); const historyCounter = useRef(0); const consoleEndRef = useRef(null); + const terminalContainerRef = useRef(null); const inputRef = useRef(null); const commandHistoryRef = useRef([]); const historyIndexRef = useRef(-1); const scrollToBottom = () => { - consoleEndRef.current?.scrollIntoView({ behavior: 'smooth' }); + if (terminalContainerRef.current) { + terminalContainerRef.current.scrollTop = terminalContainerRef.current.scrollHeight; + } }; useEffect(() => { @@ -69,6 +72,7 @@ export function SeccionSistema() { const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === 'Enter') { + e.preventDefault(); handleExecuteMongosh(); } else if (e.key === 'ArrowUp') { e.preventDefault(); @@ -168,6 +172,7 @@ export function SeccionSistema() {
inputRef.current?.focus({ preventScroll: true })} >