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