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

Commit 4b5faf8

Browse files
committed
Update top vs. bottom sticky styles separately
If a sublist changes from sticky top to sticky bottom in a single run of the logic (without passing through the default state), we were leaving the previous top position set. This handles them independently to resolve this. Fixes element-hq/element-web#14390 Maybe helps with element-hq/element-web#14443 For element-hq/element-web#13635
1 parent edb1978 commit 4b5faf8

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/components/structures/LeftPanel2.tsx

Lines changed: 14 additions & 10 deletions
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)