fix(chat): scroll móvil + input no desaparece al teclear

- Wrapper del chat: flex-1 + min-h-0 (en vez de h-full) para scroll correcto
- Área de mensajes: min-h-0 explícito — crítico para que flex-1 haga scroll en iOS/Android
- Input: flex-shrink:0 inline para reforzar que nunca se comprima
- visualViewport: usa requestAnimationFrame para scroll más suave, elimina listener scroll

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro
2026-07-14 02:34:48 +00:00
co-authored by Claude Sonnet 4.6
parent 65c569b333
commit a3bd91c204
2 changed files with 13 additions and 10 deletions
+9 -6
View File
@@ -109,17 +109,20 @@
const root = document.getElementById('chat-root');
if (!root || !window.visualViewport) return;
const isMobile = window.innerWidth < 640;
if (!isMobile) return; // En desktop no necesitamos ajustar
const update = () => {
root.style.height = window.visualViewport.height + 'px';
const vh = window.visualViewport.height;
// En móvil: ajustamos #chat-root a la altura visual real
if (window.innerWidth < 640) {
root.style.height = vh + 'px';
}
// Scroll al fondo siempre que cambie el viewport
const msgs = document.getElementById('pub-messages');
if (msgs) setTimeout(() => { msgs.scrollTop = msgs.scrollHeight; }, 50);
if (msgs) {
requestAnimationFrame(() => { msgs.scrollTop = msgs.scrollHeight; });
}
};
window.visualViewport.addEventListener('resize', update);
window.visualViewport.addEventListener('scroll', update);
update();
}