forked from retoor/snek
fix: correct double-g scroll target to last message element
The double-g press handler was incorrectly scrolling to the first child of the messages container instead of the last element, causing the viewport to jump to the top of the conversation rather than the most recent message. Changed the selector from `.message:first-child` to `lastElementChild` to properly scroll to the latest message before triggering `loadExtra()`.
This commit is contained in:
@@ -227,7 +227,7 @@ document.addEventListener('keydown', function(event) {
|
||||
keyTimeout = setTimeout(() => { gPressCount = 0; }, 300);
|
||||
if (gPressCount === 2) {
|
||||
gPressCount = 0;
|
||||
messagesContainer.querySelector(".message:first-child")?.scrollIntoView({ block: "end", inline: "nearest" });
|
||||
messagesContainer.lastElementChild?.scrollIntoView({ block: "end", inline: "nearest" });
|
||||
loadExtra();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user