From 065b65a764b74f4e6e8201ae3a364c29ef2dbb6c Mon Sep 17 00:00:00 2001 From: Germain Date: Mon, 29 Nov 2021 17:03:53 +0000 Subject: [PATCH] Hide scrollbar if content height is smaller than scroll node height (#7220) --- res/css/structures/_RoomView.scss | 4 ++++ src/components/structures/ScrollPanel.tsx | 2 ++ 2 files changed, 6 insertions(+) diff --git a/res/css/structures/_RoomView.scss b/res/css/structures/_RoomView.scss index d7e31e618d..a3beb2dd69 100644 --- a/res/css/structures/_RoomView.scss +++ b/res/css/structures/_RoomView.scss @@ -120,6 +120,10 @@ limitations under the License. overflow-y: auto; flex: 1 1 0; overflow-anchor: none; + + &[data-scrollbar=false] { + overflow-y: hidden; + } } .mx_RoomView_messagePanelSearchSpinner { diff --git a/src/components/structures/ScrollPanel.tsx b/src/components/structures/ScrollPanel.tsx index 1699b535d9..103796122f 100644 --- a/src/components/structures/ScrollPanel.tsx +++ b/src/components/structures/ScrollPanel.tsx @@ -750,6 +750,8 @@ export default class ScrollPanel extends React.Component { const minHeight = sn.clientHeight; const height = Math.max(minHeight, contentHeight); this.pages = Math.ceil(height / PAGE_SIZE); + const displayScrollbar = contentHeight > minHeight; + sn.dataset.scrollbar = displayScrollbar.toString(); this.bottomGrowth = 0; const newHeight = `${this.getListHeight()}px`;