Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit d182961

Browse files
authored
Merge pull request #4966 from matrix-org/jryans/sticky-madness
Update top vs. bottom sticky styles separately
2 parents edb1978 + 4b5faf8 commit d182961

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/components/structures/LeftPanel2.tsx

+14-10
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,23 @@ export default class LeftPanel2 extends React.Component<IProps, IState> {
187187
if (header.style.top !== newTop) {
188188
header.style.top = newTop;
189189
}
190-
} else if (style.stickyBottom) {
190+
} else {
191+
if (header.classList.contains("mx_RoomSublist2_headerContainer_stickyTop")) {
192+
header.classList.remove("mx_RoomSublist2_headerContainer_stickyTop");
193+
}
194+
if (header.style.top) {
195+
header.style.removeProperty('top');
196+
}
197+
}
198+
199+
if (style.stickyBottom) {
191200
if (!header.classList.contains("mx_RoomSublist2_headerContainer_stickyBottom")) {
192201
header.classList.add("mx_RoomSublist2_headerContainer_stickyBottom");
193202
}
203+
} else {
204+
if (header.classList.contains("mx_RoomSublist2_headerContainer_stickyBottom")) {
205+
header.classList.remove("mx_RoomSublist2_headerContainer_stickyBottom");
206+
}
194207
}
195208

196209
if (style.stickyTop || style.stickyBottom) {
@@ -209,21 +222,12 @@ export default class LeftPanel2 extends React.Component<IProps, IState> {
209222
if (header.classList.contains("mx_RoomSublist2_headerContainer_sticky")) {
210223
header.classList.remove("mx_RoomSublist2_headerContainer_sticky");
211224
}
212-
if (header.classList.contains("mx_RoomSublist2_headerContainer_stickyTop")) {
213-
header.classList.remove("mx_RoomSublist2_headerContainer_stickyTop");
214-
}
215-
if (header.classList.contains("mx_RoomSublist2_headerContainer_stickyBottom")) {
216-
header.classList.remove("mx_RoomSublist2_headerContainer_stickyBottom");
217-
}
218225
if (headerContainer.classList.contains("mx_RoomSublist2_headerContainer_hasSticky")) {
219226
headerContainer.classList.remove("mx_RoomSublist2_headerContainer_hasSticky");
220227
}
221228
if (header.style.width) {
222229
header.style.removeProperty('width');
223230
}
224-
if (header.style.top) {
225-
header.style.removeProperty('top');
226-
}
227231
}
228232
}
229233

0 commit comments

Comments
 (0)