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

Commit 7b71a9f

Browse files
authored
Fix room list scroll jumps (#7991)
Signed-off-by: Robin Townsend <[email protected]>
1 parent 14684c6 commit 7b71a9f

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

res/css/views/rooms/_RoomSublist.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ limitations under the License.
5050
height: 24px;
5151
color: $tertiary-content;
5252

53+
.mx_RoomSublist_stickableContainer {
54+
width: 100%;
55+
}
56+
5357
.mx_RoomSublist_stickable {
5458
flex: 1;
5559
max-width: 100%;
@@ -176,6 +180,14 @@ limitations under the License.
176180
}
177181
}
178182

183+
// In the general case, we reserve space for each sublist header to prevent
184+
// scroll jumps when they become sticky. However, that leaves a gap when
185+
// scrolled to the top above the first sublist (whose header can only ever
186+
// stick to top), so we make sure to exclude the first visible sublist.
187+
&:not(.mx_RoomSublist_hidden) ~ .mx_RoomSublist .mx_RoomSublist_stickableContainer {
188+
height: 24px;
189+
}
190+
179191
.mx_RoomSublist_resizeBox {
180192
position: relative;
181193

src/components/views/rooms/RoomSublist.tsx

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -698,25 +698,27 @@ export default class RoomSublist extends React.Component<IProps, IState> {
698698
onFocus={onFocus}
699699
aria-label={this.props.label}
700700
>
701-
<div className="mx_RoomSublist_stickable">
702-
<Button
703-
onFocus={onFocus}
704-
inputRef={ref}
705-
tabIndex={tabIndex}
706-
className="mx_RoomSublist_headerText"
707-
role="treeitem"
708-
aria-expanded={this.state.isExpanded}
709-
aria-level={1}
710-
onClick={this.onHeaderClick}
711-
onContextMenu={this.onContextMenu}
712-
title={this.props.isMinimized ? this.props.label : undefined}
713-
>
714-
<span className={collapseClasses} />
715-
<span>{ this.props.label }</span>
716-
</Button>
717-
{ this.renderMenu() }
718-
{ this.props.isMinimized ? null : badgeContainer }
719-
{ this.props.isMinimized ? null : addRoomButton }
701+
<div className="mx_RoomSublist_stickableContainer">
702+
<div className="mx_RoomSublist_stickable">
703+
<Button
704+
onFocus={onFocus}
705+
inputRef={ref}
706+
tabIndex={tabIndex}
707+
className="mx_RoomSublist_headerText"
708+
role="treeitem"
709+
aria-expanded={this.state.isExpanded}
710+
aria-level={1}
711+
onClick={this.onHeaderClick}
712+
onContextMenu={this.onContextMenu}
713+
title={this.props.isMinimized ? this.props.label : undefined}
714+
>
715+
<span className={collapseClasses} />
716+
<span>{ this.props.label }</span>
717+
</Button>
718+
{ this.renderMenu() }
719+
{ this.props.isMinimized ? null : badgeContainer }
720+
{ this.props.isMinimized ? null : addRoomButton }
721+
</div>
720722
</div>
721723
{ this.props.isMinimized ? badgeContainer : null }
722724
{ this.props.isMinimized ? addRoomButton : null }

0 commit comments

Comments
 (0)