From 070763f164b44be654aab7bea62998e720813022 Mon Sep 17 00:00:00 2001 From: Anthony Date: Sat, 24 Jul 2021 22:32:51 +0200 Subject: [PATCH] scroll properly when switching tabs --- ui/component/livestreamComments/view.jsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/ui/component/livestreamComments/view.jsx b/ui/component/livestreamComments/view.jsx index 43cd71bfc..2eb1cbcd5 100644 --- a/ui/component/livestreamComments/view.jsx +++ b/ui/component/livestreamComments/view.jsx @@ -156,10 +156,15 @@ export default function LivestreamComments(props: Props) { 'button-toggle--active': viewMode === VIEW_MODE_CHAT, })} label={__('Chat')} - onClick={() => setViewMode(VIEW_MODE_CHAT)} + onClick={function() { + setViewMode(VIEW_MODE_CHAT); + const livestreamCommentsDiv = document.getElementsByClassName('livestream__comments')[0] + const divHeight = livestreamCommentsDiv.scrollHeight; + livestreamCommentsDiv.scrollTop = divHeight; + }} /> - {/* the list by tip amount value button */} + {/* the button to show superchats listed by most to least support amount */}