From 15ea9d8c917d6d0408a9c48f38976d19f9936054 Mon Sep 17 00:00:00 2001 From: eugenijm Date: Fri, 6 Nov 2020 01:20:08 +0300 Subject: Fix the chat scroll behavior for vertical screens. Fetch the messages until the scrollbar becomes visible, so that the user always has the ability to scroll up and load new messages. --- src/components/chat/chat_layout_utils.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/components/chat/chat_layout_utils.js') diff --git a/src/components/chat/chat_layout_utils.js b/src/components/chat/chat_layout_utils.js index 609dc0c9..50a933ac 100644 --- a/src/components/chat/chat_layout_utils.js +++ b/src/components/chat/chat_layout_utils.js @@ -24,3 +24,10 @@ export const isBottomedOut = (el, offset = 0) => { export const scrollableContainerHeight = (inner, header, footer) => { return inner.offsetHeight - header.clientHeight - footer.clientHeight } + +// Returns whether or not the scrollbar is visible. +export const isScrollable = (el) => { + if (!el) return + + return el.scrollHeight > el.clientHeight +} -- cgit v1.2.3-70-g09d2