-
-
Notifications
You must be signed in to change notification settings - Fork 833
Redesign: restyle jump to first unread message & rework read marker logic #2322
Conversation
with placeholder for message count
Needs more work actually, marking as not ready. |
d5267a8
to
82d5873
Compare
82d5873
to
04e1542
Compare
Make Timer revert back to not started state so you can't forget to clone it like was the case here.
and change timeout on timer when that changes
so allow the jump button to be visible
as it will immediately put it to the bottom with new logic
makes the useractivity logic more consistent then doing it in timelinepanle when user switches away from the page.
this looks awesome! although i'm finding the size of patch a little hard to review (this is my 3rd time of trying to read through it but failing to track all the changes in my head). It might be useful to know whether this is going to change the timing semantics for presence or typing notifs etc at all, or if it keeps backwards compatibility with the prior behaviour there? Also, how does it feel? is 30s too short or too long for removing the off-screen-RM? I assume the 30s has to be consecutive seconds of activity in a given room? If you start viewing a room, but then stop interacting with the app, does it stop the timer and only start counting again when you start being active again? (Sorry if this is clear from the code or the initial comment, but my brain is failing) Ftr, I talked @AmandineLP through this yesterday and she has concerns about ever destroying off-screen bookmarks, although I think we should how this feels first before we creep it in future towards the full "track all RM bookmarks" solution. |
I'm restructuring the commits with better commit messages so it's clearer. I went over several iterations and it show in the commit log I suppose :).
It should not, apart from the fact that you'll be marked on-line when you go back to your riot tab/window as well, without using mouse or keyboard in the page. This is collateral, but I thought an improvement, see below.
Well, you don't see the RM as it is moved from above the viewport to below it. So you're not really aware. From my brief testing, it does feel better than before, but I think there is room for experimentation here like, off-the-top-of-my-head: a timeout based on the amount of events between where the RM and where it would be moved to, or just a bigger value. The 10s to move it when in view does feel a bit long, given that before it used to be 500ms.
Yes & no; what is considered "user activity" is different now, but if that is interrupted, the timeout does reset. Before it meant the user has touched their hardware very recently. Now, it's an educated guess that the user is looking at app, still starting it by taking the keyboard and mouse queues from before, but also when you switch back to the tab or window. The activity ends with a timeout of 2 minutes (instead of 500ms), or switching away from the tab or window. I did it this way because for the larger 30s timeout for the out-of-view RM you can't expect continuous hardware interaction, this is why Presence also ignored
👍 |
Fixed Presence not being updated often enough btw, see f856a64. |
element-hq/element-web#7591
The read marker logic is also changed, as https://github.com/vector-im/riot-web/issues/4134 has been a long outstanding issue, and making the feature look different without making it work well didn't make sense.
The read marker is now also updated if it is currently above the viewport:
After the timeout elapses, the read marker is moved below the last event in the viewport when timeout elapses, as before.
The timeout is aborted when the user becomes inactive. The read marker is not touched, and the timer starts counting again once the user is active again. What is considered user activity changed a bit as well: the user is considered active when activating the tab/window, moving the mouse or scrollwheel, or using the keyboard. The user is considered inactive when blurring the window/tab, or 2 minutes have elapsed since the last interaction event was fired. This to prevent the read marker being updated when we know the user is not looking at the page.
Also added a Timer class using promises as the clear/setTimeout's were going to grow a bit unwieldy. Should be reusable for other timeout related usecases.
I'm not doing the badge count for now, as many rooms have gaps in their timeline so we can't give an accurate number of messages since the unread marker. Tried it and it looks confusing.
Parked the work for the badge on the
bwindels/jumptofirstunread-badgecount
branch (also on js-sdk) if we ever want to get back to it.