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

Improve performance and stability in sticky headers for new room list #4931

Merged
merged 3 commits into from
Jul 9, 2020

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Jul 8, 2020

turt2live added 3 commits July 8, 2020 12:17
It should be in all major browsers as of years ago, and we use it unguarded elsewhere in the app. The performance benefits of it appear to be worthwhile enough to keep it, though it's not a perfect solution.
We now use offsets and scroll information to determine where the headers should be stuck to, still supporting the transparent background.

Some scroll jumps were originally introduced as part of the change in numbering, so they have been fixed here. By proxy, some additional scroll jump/instability should be fixed as well.

This has a lingering problem of still causing a huge number of no-op UI updates though, which will be dealt with in a future commit.
The layout updates are anecdotal based on devtools flagging the values which are "changing" even if they aren't.  The scrolling feels better with this as well, though this might be placebo.
@turt2live turt2live requested a review from a team July 8, 2020 21:04
header.style.width = `${headerStickyWidth}px`;
header.style.top = `${rlRect.top - HEADER_HEIGHT}px`;
// When an element is <=40% off screen, make it take over
const offScreenFactor = 0.4;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bwindels this number is fairly arbitrary, but should match the old 60% value with the older math. Might need some tweaking on the refresh.

@jryans
Copy link
Collaborator

jryans commented Jul 9, 2020

This PR does fix the overscroll fighting at the top of list (element-hq/element-web#14377), but it introduces a similar overscroll fighting issue at the bottom of the list.

@bwindels bwindels requested review from bwindels and removed request for a team July 9, 2020 12:11
Copy link
Contributor

@bwindels bwindels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might need to play a bit with the offscreen factor once merged, but otherwise seems reasonable.

@turt2live turt2live merged commit bd8e1f7 into develop Jul 9, 2020
@turt2live turt2live deleted the travis/room-list/sticky-headers branch July 9, 2020 14:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants