-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scrolling: Improving jumps on timeline pagination/scrolling #8565
Comments
One possible approach to have the timeline prevent jumping in a more reliable way I was thinking of is the following: We observe the On scroll, we also keep track of which event tile is the last one that is still in view and calculate the offset to the bottom of the viewport. When the timeline resizes (through the ResizeObserver), we adjust the container One added benefit is that it would make it easier to switch to native scrollbars for the timeline, because the timeline does need to be made aware of size changes (which are now tracked through an overlaying iframe with gemini scrollbars), so doing it with a standardized API that will hopefully become widely supported and has a polyfill that from the looks of it should be better performing (mutation events) than the gemini iframe approach seems like a good thing. |
Also try to fix #8792 |
Also looking at #8653 as part of this |
Also #8455 |
This is definitely a big improvement, but it's worth noting that it can still jump pretty badly on E2E rooms, especially if they contain code blocks. Theory is that if the JS falls behind the DOM events significantly due to GCs, things get out of sync and we still see jumps - so the more work JS is doing, the more likelihood of seeing a jump. I was able to reproduce this pretty well during the security breach of Apr 11 when trying to rapidly scroll the E2E rooms we were using to coordinate response, which had lots of code blocks as people shared details. |
(It's also possible that the bad GCs triggered by #11267 might make this worse). separately, @madduck is seeing something that looks like a really bad instance of this (or a new regression in FF72 on Sid?) over at https://scratch.madduck.net/riot-web-scroll-jumping-around-screencast-by-martin.mp4 |
Interesting @madduck, same config as I have. So no improvement at all? |
@bwindels no improvements, no... |
Just wanted to reiterate that scrolling behaviour is still awful for me on Riot Desktop 1.6.0 on Arch Linux. Apart from the jumping around, the worst thing is that the scrollbar grip (the thing you grab) seems to stick to the top of the scrollbar as new events are loaded. This results in continual pagination deeper and deeper into the history, with no easy way of stopping. I think the proper behaviour would be for the grip to move downwards from the top after each batch of new events is loaded and then stay there, forcing the user to again move the grip upwards if he wants to scroll even deeper. The point is that each deeper fetch should necessitate explicit user action instead of being automatic. I think #8455 might be talking about this problem? |
This is an issue for me too on Mac (Riot Desktop v1.6.2). It's pretty frustrating. It has been this way for months. |
This happens to me alot when scrolling through the history of a room. Example of a room: #element-web:matrix.org @bwindels since you are assigned to this issue and given the priority of it, what is the status? From the comments I read that it might be hard to reproduce? On my setup, I can easily reproduce (also on different operating systems). I am open to invest some time to get required information in order to proceed with this. We could also try to arrange some virtual meeting, so you can reproduce it on my setup. |
This also happens on the Desktop app (tested on Linux). Using Element is extremely unsatisfying due to this issue. Another ping @bwindels @turt2live @ara4n My offer to help with debuggin this or whatever is needed (in case you cannot reproduce) still stands. Also the mozilla label is a bit misleading, since it also happens on Firefox, but also on all other browsers, I guess. |
@claell do you have browser and OS information you can give us to investigate? We'd also need to know exactly what you're doing to have it happen so we can reproduce it. Screen recordings help a lot. The mozilla label has nothing to do with Firefox or browsers - it just means that Mozilla, one of our customers, is having the issue too. Not sure why I've been pinged on this in any case. |
Tested on Firefox (always used the currently most up to date version) on Windows and Manjaro (both the most current versions). Also happened to me with the element app on Manjaro, don't know about Windows. I also linked a room where this happens. I basically just scroll throuh the backlog. So I for example go about 600 messages up (what arrived when I was last viewing) and then scroll down towards the most recent ones. While scrolling there are sometimes jumps (happens when scrolling with mouse wheel as well as when scrolling using the Does that mean you didn't manage to reproduce the issue? If you can't, your system information might also be helpful. I will see if I can do a screen recording. Before I'd like to get some reply first that somebody is currently actively working on this (or will be after posting the screen recording). Else I guess it won't be worth the effort if this issue is stalled for another half a year afterwards, since then the recording might be considered outdated by then.
Ah, got it.
I pinged you because you triaged this in the past. Since there has been no action in this issue from the assignee since about half a year and given the set priority and severity (!), I thought it is probably best to also ping people who triaged this in the past in case this is currently stalled. |
@dkasak's description of the problem is exactly what I'm seeing. I came here to see if there were any open tickets about scroll jumping after finding it incredibly frustrating to attempt to browse the recent history in the big Matrix/Element rooms. Turns out that the problem was that I was using the scrollbar. After reading this issue, I tried using the page up and down keys, and it worked perfectly. I had not tried to use the keys previously, because I first tried to use the up and down arrow keys, which is how I normally scroll through pages, and saw, to my dismay, that they did not work and so I incorrectly assumed that I had to use the scroll bar, which is completely unusable, without trying page up. As an aside, I haven't looked if there's an issue open for this, but scroll jumping is also a problem on the "Explore rooms" page, and, unfortunately, only the scroll bar "works" there. |
@pwinckles When you say "scroll bar" do you really mean that? Have you tried using the mouse wheel to scroll? |
Apparently I overeastimated the importance of this issue slightly given there currently are 251 (!) open issues with This is a bit discouraging, still I hope that all those issues get much attention to solve them. |
This comment has been minimized.
This comment has been minimized.
@grahamperrin I had a short look. From what I understand, that issue is not related to this one, but might be wrong. |
I think I've figured out at least part of the problem. I was scrolling through a very active chat and trying to read every post sent since last night, and while it didn't only bug out at these times, it bugged out the most when I reached 12:59 AM. It tried to jump instantly to 12:13 PM the same day, instead of 1:00 AM. I think something in the logic for finding posts is sorting human-readable timestamps alphabetically, when you shouldn't be using human-readable timestamps at all for this sort of operation. You should instead be using UNIX timestamps (at which point you can safely use alphabetical search just fine if you still store them as strings), and optimally storing them as actual numbers. I've verified this happens in Element Desktop as well as Element Web in Firefox, so it's not a browser bug or extension causing interference. |
Interesting finding, that would be a pretty weird cause for this. |
On further reflection, it doesn't make all that much sense, and doesn't behave like that consistently. I do think there's something very.. Wrong with how it stores information on the sequence of messages. Sometimes scrolling slowly will eventually lead me to a place where I can't scroll any further, but if I scroll fast it'll get me past that... And it'll jump hours or even days into the past/future (depending on if I'm scrolling up or down), and not give anything in between... But if I manage to somehow get to a post in between (like by following someone's reply to such a post), it works until I get to one of the 'jump posts' before, and then it stops working. On some occasions, when I manage to get into an 'in between' post, it causes Element to take up 100% of the CPU for seemingly no reason, and scrolling is very choppy and slow. Get to one of the points where it'd normally not let me go past it, and that clears up... As soon as it's at a place where it again treats those 'endpoints' as brick walls that I can't scroll past. I can excuse occasional small jumps while scrolling, which also happen.. After all, I understand that as I scroll, things are removed from one end of the page and added to the other end. It's not a trivial problem to solve, especially when you're limited to browser APIs. But that's not the only thing that happens. Entire hours or days of chats are inaccessible except by pure luck or arcane tricks. Scrolling will occasionally force a page into an endless loop of loading page after page of chat posts in only a few seconds, I guess because the first segment coming in doesn't move the scrollbar up enough or something? I don't know exactly what triggers that. And just.. Overall, scrolling through large chats isn't just difficult, but many times it's impossible. And that's not even counting how often Element - whether I scroll or not, but usually when I scroll or shortly after (maybe when it loads another batch of posts?) - just completely blanks out all the posts and shows nothing, just a scrollable empty page until I get to another point where it starts loading more posts. This tells me that something in the very core of the design is fundamentally broken. If you have that many edge cases that you need to keep accounting for more and more and more, with that bad of behavior even after accounting for many of them... Then you need to stop trying to fix the edge cases, and instead wipe ALL of it from orbit and start over from scratch, because the very essence of the idea used from the very beginning was wrong. |
https://develop.element.io/ at the time of writingFrom matrix-org/matrix-react-sdk#5920 (comment):
Today I'm getting this bounce, varying distances, with nearly every Page Down whilst trying to catch up in https://matrix.to/#/!qZXgYtEIHagWHrEQQb:matrix.org/$1619805180386752XkYsC:matrix.org?via=matrix.org for example, here (selected) is what was previously the lowermost line:
I have smooth scrolling enabled in Firefox, the jumpiness is as if smooth scrolling is not enabled. I ran a quick search for smooth scroll, found two (merged) PRs matrix-org/matrix-react-sdk#2676 and matrix-org/matrix-react-sdk#3051 … … expanded my search and found myself here, #8565, am I in the right place? If so: I doubt that matrix-org/matrix-react-sdk#5920 has worsened the situation. More likely: I previously never noticed (or habitually ignored) things such as jumpiness because Page Down was so broken that I simply could not use Matrix/Riot/Element to catch up in some rooms. Postscript
After re-enabling the experimental layout: – I found things not jumpy ☑️ – touch wood – in |
I recently tested again and can still make element on the web jump (might have improved slightly, though). |
* Go to space landing page when clicking on a selected space ([\element-hq#6442](matrix-org/matrix-react-sdk#6442)). Fixes element-hq#20296. * Fall back to untranslated string rather than showing missing translation error ([\element-hq#8609](matrix-org/matrix-react-sdk#8609)). * Show file name and size on images on hover ([\element-hq#6511](matrix-org/matrix-react-sdk#6511)). Fixes element-hq#18197. * Iterate on search results for message bubbles ([\element-hq#7047](matrix-org/matrix-react-sdk#7047)). Fixes element-hq#20315. * registration: redesign email verification page ([\element-hq#8554](matrix-org/matrix-react-sdk#8554)). Fixes element-hq#21984. * Show full thread message in hover title on thread summary ([\element-hq#8568](matrix-org/matrix-react-sdk#8568)). Fixes element-hq#22037. * Tweak video rooms copy ([\element-hq#8582](matrix-org/matrix-react-sdk#8582)). Fixes element-hq#22176. * Live location share - beacon tooltip in maximised view ([\element-hq#8572](matrix-org/matrix-react-sdk#8572)). * Add dialog to navigate long room topics ([\element-hq#8517](matrix-org/matrix-react-sdk#8517)). Fixes element-hq#9623. * Change spaceroomfacepile tooltip if memberlist is shown ([\element-hq#8571](matrix-org/matrix-react-sdk#8571)). Fixes element-hq#17406. * Improve message editing UI ([\element-hq#8483](matrix-org/matrix-react-sdk#8483)). Fixes element-hq#9752 and element-hq#22108. * Make date changes more obvious ([\element-hq#6410](matrix-org/matrix-react-sdk#6410)). Fixes element-hq#16221. * Enable forwarding static locations ([\element-hq#8553](matrix-org/matrix-react-sdk#8553)). * Log `TimelinePanel` debugging info when opening the bug report modal ([\element-hq#8502](matrix-org/matrix-react-sdk#8502)). * Improve welcome screen, add opt-out analytics ([\element-hq#8474](matrix-org/matrix-react-sdk#8474)). Fixes element-hq#21946. * Converting selected text to MD link when pasting a URL ([\element-hq#8242](matrix-org/matrix-react-sdk#8242)). Fixes element-hq#21634. Contributed by @Sinharitik589. * Support Inter on custom themes ([\element-hq#8399](matrix-org/matrix-react-sdk#8399)). Fixes element-hq#16293. * Add a `Copy link` button to the right-click message context-menu labs feature ([\element-hq#8527](matrix-org/matrix-react-sdk#8527)). * Move widget screenshots labs flag to devtools ([\element-hq#8522](matrix-org/matrix-react-sdk#8522)). * Remove some labs features which don't get used or create maintenance burden: custom status, multiple integration managers, and do not disturb ([\element-hq#8521](matrix-org/matrix-react-sdk#8521)). * Add a way to toggle `ScrollPanel` and `TimelinePanel` debug logs ([\element-hq#8513](matrix-org/matrix-react-sdk#8513)). * Spaces: remove blue beta dot ([\element-hq#8511](matrix-org/matrix-react-sdk#8511)). Fixes element-hq#22061. * Order new search dialog results by recency ([\element-hq#8444](matrix-org/matrix-react-sdk#8444)). * Improve pills ([\element-hq#6398](matrix-org/matrix-react-sdk#6398)). Fixes element-hq#16948 and element-hq#21281. * Add a way to maximize/pin widget from the PiP view ([\element-hq#7672](matrix-org/matrix-react-sdk#7672)). Fixes element-hq#20723. * Iterate video room designs in labs ([\element-hq#8499](matrix-org/matrix-react-sdk#8499)). * Improve UI/UX in calls ([\element-hq#7791](matrix-org/matrix-react-sdk#7791)). Fixes element-hq#19937. * Add ability to change audio and video devices during a call ([\element-hq#7173](matrix-org/matrix-react-sdk#7173)). Fixes element-hq#15595. * Fix video rooms sometimes connecting muted when they shouldn't ([\element-hq#22125](element-hq#22125)). * Avoid flashing the 'join conference' button at the user in video rooms ([\element-hq#22120](element-hq#22120)). * Fully close Jitsi conferences on errors ([\element-hq#22060](element-hq#22060)). * Fix click behavior of notification badges on spaces ([\element-hq#8627](matrix-org/matrix-react-sdk#8627)). Fixes element-hq#22241. * Add missing return values in Read Receipt animation code ([\element-hq#8625](matrix-org/matrix-react-sdk#8625)). Fixes element-hq#22175. * Fix 'continue' button not working after accepting identity server terms of service ([\element-hq#8619](matrix-org/matrix-react-sdk#8619)). Fixes element-hq#20003. * Proactively fix stuck devices in video rooms ([\element-hq#8587](matrix-org/matrix-react-sdk#8587)). Fixes element-hq#22131. * Fix position of the message action bar on left side bubbles ([\element-hq#8398](matrix-org/matrix-react-sdk#8398)). Fixes element-hq#21879. Contributed by @luixxiul. * Fix edge case thread summaries around events without a msgtype ([\element-hq#8576](matrix-org/matrix-react-sdk#8576)). * Fix favourites metaspace not updating ([\element-hq#8594](matrix-org/matrix-react-sdk#8594)). Fixes element-hq#22156. * Stop spaces from displaying as rooms in new breadcrumbs ([\element-hq#8595](matrix-org/matrix-react-sdk#8595)). Fixes element-hq#22165. * Fix avatar position of hidden event on ThreadView ([\element-hq#8592](matrix-org/matrix-react-sdk#8592)). Fixes element-hq#22199. Contributed by @luixxiul. * Fix MessageTimestamp position next to redacted messages on IRC/modern layout ([\element-hq#8591](matrix-org/matrix-react-sdk#8591)). Fixes element-hq#22181. Contributed by @luixxiul. * Fix padding of messages in threads ([\element-hq#8574](matrix-org/matrix-react-sdk#8574)). Contributed by @luixxiul. * Enable overflow of hidden events content ([\element-hq#8585](matrix-org/matrix-react-sdk#8585)). Fixes element-hq#22187. Contributed by @luixxiul. * Increase composer line height to avoid cutting off emoji ([\element-hq#8583](matrix-org/matrix-react-sdk#8583)). Fixes element-hq#22170. * Don't consider threads for breaking continuation until actually created ([\element-hq#8581](matrix-org/matrix-react-sdk#8581)). Fixes element-hq#22164. * Fix displaying hidden events on threads ([\element-hq#8555](matrix-org/matrix-react-sdk#8555)). Fixes element-hq#22058. Contributed by @luixxiul. * Fix button width and align 絵文字 (emoji) on the user panel ([\element-hq#8562](matrix-org/matrix-react-sdk#8562)). Fixes element-hq#22142. Contributed by @luixxiul. * Standardise the margin for settings tabs ([\element-hq#7963](matrix-org/matrix-react-sdk#7963)). Fixes element-hq#20767. Contributed by @yuktea. * Fix room history not being visible even if we have historical keys ([\element-hq#8563](matrix-org/matrix-react-sdk#8563)). Fixes element-hq#16983. * Fix oblong avatars in video room lobbies ([\element-hq#8565](matrix-org/matrix-react-sdk#8565)). * Update thread summary when latest event gets decrypted ([\element-hq#8564](matrix-org/matrix-react-sdk#8564)). Fixes element-hq#22151. * Fix codepath which can wrongly cause automatic space switch from all rooms ([\element-hq#8560](matrix-org/matrix-react-sdk#8560)). Fixes element-hq#21373. * Fix effect of URL preview toggle not updating live ([\element-hq#8561](matrix-org/matrix-react-sdk#8561)). Fixes element-hq#22148. * Fix visual bugs on AccessSecretStorageDialog ([\element-hq#8160](matrix-org/matrix-react-sdk#8160)). Fixes element-hq#19426. Contributed by @luixxiul. * Fix the width bounce of the clock on the AudioPlayer ([\element-hq#8320](matrix-org/matrix-react-sdk#8320)). Fixes element-hq#21788. Contributed by @luixxiul. * Hide the verification left stroke only on the thread list ([\element-hq#8525](matrix-org/matrix-react-sdk#8525)). Fixes element-hq#22132. Contributed by @luixxiul. * Hide recently_viewed dropdown when other modal opens ([\element-hq#8538](matrix-org/matrix-react-sdk#8538)). Contributed by @yaya-usman. * Only jump to date after pressing the 'go' button ([\element-hq#8548](matrix-org/matrix-react-sdk#8548)). Fixes element-hq#20799. * Fix download button not working on events that were decrypted too late ([\element-hq#8556](matrix-org/matrix-react-sdk#8556)). Fixes element-hq#19427. * Align thread summary button with bubble messages on the left side ([\element-hq#8388](matrix-org/matrix-react-sdk#8388)). Fixes element-hq#21873. Contributed by @luixxiul. * Fix unresponsive notification toggles ([\element-hq#8549](matrix-org/matrix-react-sdk#8549)). Fixes element-hq#22109. * Set color-scheme property in themes ([\element-hq#8547](matrix-org/matrix-react-sdk#8547)). Fixes element-hq#22124. * Improve the styling of error messages during search initialization. ([\element-hq#6899](matrix-org/matrix-react-sdk#6899)). Fixes element-hq#19245 and element-hq#18164. Contributed by @KalleStruik. * Don't leave button tooltips open when closing modals ([\element-hq#8546](matrix-org/matrix-react-sdk#8546)). Fixes element-hq#22121. * update matrix-analytics-events ([\element-hq#8543](matrix-org/matrix-react-sdk#8543)). * Handle Jitsi Meet crashes more gracefully ([\element-hq#8541](matrix-org/matrix-react-sdk#8541)). * Fix regression around pasting links ([\element-hq#8537](matrix-org/matrix-react-sdk#8537)). Fixes element-hq#22117. * Fixes suggested room not ellipsized on shrinking ([\element-hq#8536](matrix-org/matrix-react-sdk#8536)). Contributed by @yaya-usman. * Add global spacing between display name and location body ([\element-hq#8523](matrix-org/matrix-react-sdk#8523)). Fixes element-hq#22111. Contributed by @luixxiul. * Add box-shadow to the reply preview on the main (left) panel only ([\element-hq#8397](matrix-org/matrix-react-sdk#8397)). Fixes element-hq#21894. Contributed by @luixxiul. * Set line-height: 1 to RedactedBody inside GenericEventListSummary for IRC/modern layout ([\element-hq#8529](matrix-org/matrix-react-sdk#8529)). Fixes element-hq#22112. Contributed by @luixxiul. * Fix position of timestamp on the chat panel in IRC layout and message edits history modal window ([\element-hq#8464](matrix-org/matrix-react-sdk#8464)). Fixes element-hq#22011 and element-hq#22014. Contributed by @luixxiul. * Fix unexpected and inconsistent inheritance of line-height property for mx_TextualEvent ([\element-hq#8485](matrix-org/matrix-react-sdk#8485)). Fixes element-hq#22041. Contributed by @luixxiul. * Set the same margin to the right side of NewRoomIntro on TimelineCard ([\element-hq#8453](matrix-org/matrix-react-sdk#8453)). Contributed by @luixxiul. * Remove duplicate tooltip from user pills ([\element-hq#8512](matrix-org/matrix-react-sdk#8512)). * Set max-width for MLocationBody and MLocationBody_map by default ([\element-hq#8519](matrix-org/matrix-react-sdk#8519)). Fixes element-hq#21983. Contributed by @luixxiul. * Simplify ReplyPreview UI implementation ([\element-hq#8516](matrix-org/matrix-react-sdk#8516)). Fixes element-hq#22091. Contributed by @luixxiul. * Fix thread summary overflow on narrow message panel on bubble message layout ([\element-hq#8520](matrix-org/matrix-react-sdk#8520)). Fixes element-hq#22097. Contributed by @luixxiul. * Live location sharing - refresh beacon timers on tab becoming active ([\element-hq#8515](matrix-org/matrix-react-sdk#8515)). * Enlarge emoji again ([\element-hq#8509](matrix-org/matrix-react-sdk#8509)). Fixes element-hq#22086. * Order receipts with the most recent on the right ([\element-hq#8506](matrix-org/matrix-react-sdk#8506)). Fixes element-hq#22044. * Disconnect from video rooms when leaving ([\element-hq#8500](matrix-org/matrix-react-sdk#8500)). * Fix soft crash around threads when room isn't yet in store ([\element-hq#8496](matrix-org/matrix-react-sdk#8496)). Fixes element-hq#22047. * Fix reading of cached room device setting values ([\element-hq#8491](matrix-org/matrix-react-sdk#8491)). * Add loading spinners to threads panels ([\element-hq#8490](matrix-org/matrix-react-sdk#8490)). Fixes element-hq#21335. * Fix forwarding UI papercuts ([\element-hq#8482](matrix-org/matrix-react-sdk#8482)). Fixes element-hq#17616.
Just tested again with latest version (and in between as well, just didn't comment here). Right now, I can scroll up rather flawlessly in a chat (so going to older messages seems to work). The problems occur reproducible every time when I scroll in the other direction again. So going up 10 days or something in a larger chat works. Scrolling back to day 9 or 8 from there gives me the jumps. Windows 11, latest Element desktop client. Hopefully, this can get finally fixed some day ;) |
Still an issue with the latest version on Safari |
Matthew's summary of the problems:
https://matrix.to/#/!maVEfftuKxhnPMcckU:matrix.org/$15500048623049743lQqLW:matrix.org?via=matrix.org&via=t2l.io&via=lant.uk
Related bugs:
Update 19/3/2019
Going with a new algorithm, dubbed BACAT (Bottom-Aligned, Clipped-At-Top) scrolling, prototyped here: https://gist.github.com/bwindels/b3a3ba3fa3792f23962d894866fa7b0f
The motivation for the changes is having noticed that setting scrollTop while scrolling tends not work well on at least Chrome on macOs. Also see #528. The approach taken instead manually sets the height of the timeline in 200px increments, with the timeline being aligned to the bottom of the container element. The relatively tiny 200px height comes from the fact that we don't want the user to ever scroll off into pages of whitespace and we have no way of preventing overscroll, so by keeping it to 200px and putting a spinner 100px up from the top of the page, we avoid death by whitespace.
By changing the height of the container, we can compensate for anything that grew below the viewport to maintain what's currently visible in the viewport without jumping. For anything above the viewport growing or shrinking, we don't need to do anything as the timeline is bottom-aligned. We do need to update the height manually. To maintain scroll position after the portion above the viewport changes height, we need to set the scrollTop, as we cannot balance it out with more height changes. We do this 100ms after the user has stopped scrolling, so setting scrollTop has not nasty side-effects.
Obsolete now: Update 5/3/2019:
The resize observer approach doesn't work reliably as it can race with the scroll event, so looks like manually restoring the scroll position from event tile when it can cause a jump is the better option. These things can cause jumps:
The text was updated successfully, but these errors were encountered: