fix: prevent page scroll when transcript updates
Some checks failed
Build & Push / build-and-push (push) Has been cancelled
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:
@@ -64,9 +64,12 @@ export default function VoiceAgent({ locale, onComplete }: VoiceAgentProps) {
|
|||||||
|
|
||||||
const transcriptEndRef = useRef<HTMLDivElement>(null);
|
const transcriptEndRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
// Auto-scroll transcript
|
// Auto-scroll transcript within its container only
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
transcriptEndRef.current?.scrollIntoView({ behavior: 'smooth' });
|
const el = transcriptEndRef.current;
|
||||||
|
if (el?.parentElement) {
|
||||||
|
el.parentElement.scrollTop = el.parentElement.scrollHeight;
|
||||||
|
}
|
||||||
}, [transcript]);
|
}, [transcript]);
|
||||||
|
|
||||||
// Handle completion
|
// Handle completion
|
||||||
|
|||||||
Reference in New Issue
Block a user