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

Commit 309c178

Browse files
authored
Merge pull request #4974 from matrix-org/jryans/sticky-pop
Tweak sticky header hiding to avoid pop
2 parents f394190 + a09f773 commit 309c178

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

res/css/views/rooms/_RoomSublist2.scss

+9-6
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ limitations under the License.
4747
padding-bottom: 8px;
4848
height: 24px;
4949

50-
// Hide the header container if the contained element is stickied.
51-
// We don't use display:none as that causes the header to go away too.
52-
&.mx_RoomSublist2_headerContainer_hasSticky {
53-
height: 0;
54-
}
55-
5650
.mx_RoomSublist2_stickable {
5751
flex: 1;
5852
max-width: 100%;
@@ -180,6 +174,15 @@ limitations under the License.
180174
}
181175
}
182176

177+
// In the general case, we leave height of headers alone even if sticky, so
178+
// that the sublists below them do not jump. However, that leaves a gap
179+
// when scrolled to the top above the first sublist (whose header can only
180+
// ever stick to top), so we force height to 0 for only that first header.
181+
// See also https://github.com/vector-im/riot-web/issues/14429.
182+
&:first-child .mx_RoomSublist2_headerContainer {
183+
height: 0;
184+
}
185+
183186
.mx_RoomSublist2_resizeBox {
184187
position: relative;
185188

src/components/structures/LeftPanel2.tsx

-7
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ export default class LeftPanel2 extends React.Component<IProps, IState> {
165165
// layout updates.
166166
for (const header of targetStyles.keys()) {
167167
const style = targetStyles.get(header);
168-
const headerContainer = header.parentElement; // .mx_RoomSublist2_headerContainer
169168

170169
if (style.makeInvisible) {
171170
// we will have already removed the 'display: none', so add it back.
@@ -205,9 +204,6 @@ export default class LeftPanel2 extends React.Component<IProps, IState> {
205204
if (!header.classList.contains("mx_RoomSublist2_headerContainer_sticky")) {
206205
header.classList.add("mx_RoomSublist2_headerContainer_sticky");
207206
}
208-
if (!headerContainer.classList.contains("mx_RoomSublist2_headerContainer_hasSticky")) {
209-
headerContainer.classList.add("mx_RoomSublist2_headerContainer_hasSticky");
210-
}
211207

212208
const newWidth = `${headerStickyWidth}px`;
213209
if (header.style.width !== newWidth) {
@@ -217,9 +213,6 @@ export default class LeftPanel2 extends React.Component<IProps, IState> {
217213
if (header.classList.contains("mx_RoomSublist2_headerContainer_sticky")) {
218214
header.classList.remove("mx_RoomSublist2_headerContainer_sticky");
219215
}
220-
if (headerContainer.classList.contains("mx_RoomSublist2_headerContainer_hasSticky")) {
221-
headerContainer.classList.remove("mx_RoomSublist2_headerContainer_hasSticky");
222-
}
223216
if (header.style.width) {
224217
header.style.removeProperty('width');
225218
}

0 commit comments

Comments
 (0)