Scroll to newest chat messages in mobile
This commit is contained in:
parent
9ac14fc428
commit
9872f33185
1 changed files with 3 additions and 0 deletions
|
|
@ -251,8 +251,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anchor to bottom on new messages, unless user is reading older ones.
|
// Anchor to bottom on new messages, unless user is reading older ones.
|
||||||
|
// Also runs when the mobile panel becomes visible: while hidden the list
|
||||||
|
// has no height, so earlier scrolls were no-ops.
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
messages.length;
|
messages.length;
|
||||||
|
mobileActive;
|
||||||
if (!listEl || userScrolledUp) return;
|
if (!listEl || userScrolledUp) return;
|
||||||
tick().then(() => {
|
tick().then(() => {
|
||||||
if (listEl) listEl.scrollTop = listEl.scrollHeight;
|
if (listEl) listEl.scrollTop = listEl.scrollHeight;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue