From 7b115056b0ec64dba01f1758aa6aab7c88b418b0 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Wed, 8 Jul 2020 09:21:33 +0100
Subject: [PATCH] Fix sticky headers being left on display:none if they change
 too quickly

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
 src/components/structures/LeftPanel2.tsx | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/components/structures/LeftPanel2.tsx b/src/components/structures/LeftPanel2.tsx
index 7fac6cbff1..e67a85db25 100644
--- a/src/components/structures/LeftPanel2.tsx
+++ b/src/components/structures/LeftPanel2.tsx
@@ -146,6 +146,7 @@ export default class LeftPanel2 extends React.Component<IProps, IState> {
             const slRect = sublist.getBoundingClientRect();
 
             const header = sublist.querySelector<HTMLDivElement>(".mx_RoomSublist2_stickable");
+            header.style.removeProperty("display"); // always clear display:none first
 
             if (slRect.top + headerHeight > bottom && !gotBottom) {
                 header.classList.add("mx_RoomSublist2_headerContainer_sticky");
@@ -161,8 +162,6 @@ export default class LeftPanel2 extends React.Component<IProps, IState> {
                 if (lastTopHeader) {
                     lastTopHeader.style.display = "none";
                 }
-                // first unset it, if set in last iteration
-                header.style.removeProperty("display");
                 lastTopHeader = header;
             } else {
                 header.classList.remove("mx_RoomSublist2_headerContainer_sticky");