fix: prevent page scroll when transcript updates
Some checks failed
Build & Push / build-and-push (push) Has been cancelled

Scroll only within transcript container, not the entire page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-28 14:40:31 +01:00
parent 015ae49d2d
commit c48313ad91

View File

@@ -64,9 +64,12 @@ export default function VoiceAgent({ locale, onComplete }: VoiceAgentProps) {
const transcriptEndRef = useRef<HTMLDivElement>(null);
// Auto-scroll transcript
// Auto-scroll transcript within its container only
useEffect(() => {
transcriptEndRef.current?.scrollIntoView({ behavior: 'smooth' });
const el = transcriptEndRef.current;
if (el?.parentElement) {
el.parentElement.scrollTop = el.parentElement.scrollHeight;
}
}, [transcript]);
// Handle completion