Modified autoscroll in response to only scroll if the user does not manually scroll up
This commit is contained in:
parent
296a8369ca
commit
00dc2c11bb
@ -2031,9 +2031,15 @@ The new Anthropic models: Claude 3.5 Sonnet and 3.5 Haiku models are now availab
|
|||||||
}, [messages]);
|
}, [messages]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (bottomRef.current) {
|
const handleScroll = () => {
|
||||||
bottomRef.current.scrollIntoView({ behavior: "smooth" });
|
const userScrolled = window.innerHeight + window.scrollY < document.body.offsetHeight;
|
||||||
}
|
if (!userScrolled && bottomRef.current) {
|
||||||
|
bottomRef.current.scrollIntoView({ behavior: "smooth" });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('scroll', handleScroll);
|
||||||
|
return () => window.removeEventListener('scroll', handleScroll);
|
||||||
}, [messages, suggestedQuestions]);
|
}, [messages, suggestedQuestions]);
|
||||||
|
|
||||||
const handleExampleClick = async (card: typeof suggestionCards[number]) => {
|
const handleExampleClick = async (card: typeof suggestionCards[number]) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user