fix(welcome-screen): only scroll to elements not in viewport
| @@ -35,7 +35,7 @@ import { callGenericPopup, POPUP_TYPE } from './popup.js'; | ||
| 35 | 35 | import { getMessageTimeStamp } from './RossAscends-mods.js'; |
| 36 | 36 | import { renderTemplateAsync } from './templates.js'; |
| 37 | 37 | import { accountStorage } from './util/AccountStorage.js'; |
| 38 | 38 | import { flashHighlight, isElementInViewport, sortMoments, timestampToMoment } from './utils.js'; |
| 39 | 39 | |
| 40 | 40 | const assistantAvatarKey = 'assistant'; |
| 41 | 41 | const pinnedChatsKey = 'pinnedChats'; |
| @@ -616,7 +616,9 @@ async function refreshWelcomeScreen({ flashChat = null } = {}) { | ||
| 616 | 616 | ((flashChat.is_group && group === flashChat.group) || (!flashChat.is_group && avatar === flashChat.avatar)); |
| 617 | 617 | }); |
| 618 | 618 | if (chatToFlash instanceof HTMLElement) { |
| 619 | + if (!isElementInViewport(chatToFlash)) { | |
| 619 | 620 | chatElement.scrollTop = chatToFlash.offsetTop - chatElement.offsetTop - (chatToFlash.clientHeight / 2); |
| 621 | + } | |
| 620 | 622 | flashHighlight($(chatToFlash), 1000); |
| 621 | 623 | } |
| 622 | 624 | } else { |