From c3377224db2d265f81809dbc1fc9f4d0a2be67f7 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Wed, 23 Oct 2024 10:30:57 +0200 Subject: [PATCH] fix: check for false positive hidden parent when scroll Signed-off-by: Maksim Sukharev --- src/components/MessagesList/MessagesList.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/MessagesList/MessagesList.vue b/src/components/MessagesList/MessagesList.vue index 5e232334fab..af202deae39 100644 --- a/src/components/MessagesList/MessagesList.vue +++ b/src/components/MessagesList/MessagesList.vue @@ -1145,7 +1145,7 @@ export default { return false // element not found } - if (element.offsetParent === null) { + if (this.isChatVisible && element.offsetParent === null) { console.debug('Message to focus is hidden, scrolling to its nearest visible parent', messageId) element = element.closest('ul[style="display: none;"]').parentElement } @@ -1153,6 +1153,8 @@ export default { console.debug('Scrolling to a focused message programmatically') this.isFocusingMessage = true + // TODO: doesn't work if chat is hidden. Need to store + // delayed 'shouldScroll' and call after chat is visible element.scrollIntoView({ behavior: smooth ? 'smooth' : 'auto', block: 'center',