fix(welcome-screen): only scroll to elements not in viewport

e5c14af76d4d4d99638414f7a09ad71587549610

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +3 -1Showing whitespace changes
public/scripts/welcome-screen.js+3 -1
@@ -35,7 +35,7 @@ import { callGenericPopup, POPUP_TYPE } from './popup.js';
3535import { getMessageTimeStamp } from './RossAscends-mods.js';
3636import { renderTemplateAsync } from './templates.js';
3737import { accountStorage } from './util/AccountStorage.js';
3838import { flashHighlight, isElementInViewport, sortMoments, timestampToMoment } from './utils.js';
3939
4040const assistantAvatarKey = 'assistant';
4141const pinnedChatsKey = 'pinnedChats';
@@ -616,7 +616,9 @@ async function refreshWelcomeScreen({ flashChat = null } = {}) {
616616 ((flashChat.is_group && group === flashChat.group) || (!flashChat.is_group && avatar === flashChat.avatar));
617617 });
618618 if (chatToFlash instanceof HTMLElement) {
619+ if (!isElementInViewport(chatToFlash)) {
619620 chatElement.scrollTop = chatToFlash.offsetTop - chatElement.offsetTop - (chatToFlash.clientHeight / 2);
621+ }
620622 flashHighlight($(chatToFlash), 1000);
621623 }
622624 } else {