mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-10 03:27:57 +00:00
fix: scroll to the top of a chat on the first click of Scroll to Top (#28659)
This commit is contained in:
parent
16f118d77a
commit
ad72dc6658
1 changed files with 11 additions and 6 deletions
|
|
@ -159,12 +159,17 @@
|
|||
messagesCount = null;
|
||||
buildMessages();
|
||||
await tick();
|
||||
if (messages.length > 0) {
|
||||
const firstMessageEl = document.getElementById(`message-${messages[0].id}`);
|
||||
if (firstMessageEl) {
|
||||
firstMessageEl.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
}
|
||||
}
|
||||
|
||||
const element = getMessagesContainer();
|
||||
if (!element) return;
|
||||
|
||||
element.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
requestAnimationFrame(() => {
|
||||
element.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
requestAnimationFrame(() => {
|
||||
element.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const updateChat = async () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue