-
-
Notifications
You must be signed in to change notification settings - Fork 827
Add shortcut to mark current room as read #11054
Add shortcut to mark current room as read #11054
Conversation
f14448f
to
2410d26
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am extremely enthusiastic about this change, thank you!
Looks like Sonarcloud has some valid changes it's asking from you, and if you can get some decent test coverage that would be awesome. (It might be effectively impossible, but definitely worth trying.)
There also appears to be a spurious typescript error, but I hope that this will be resolved by merging latest changes?
Looks like this shortcut may already be used by browsers, which we shouldn't override https://defkey.com/google-chrome-shortcuts#3071 |
It is and it has not been an issue as long as the focus is on the DOM elements of the room (see above) but I will try to find something else. |
I don't know how to manage all these cases with |
I'm fairly sure you just want |
That's what I tried first but |
As far I as I can see there should be no harm in making
but you'd need to test that it still works... |
I wonder if we could cleverly overwrite the |
We already use |
Kind of, yeah. Could we trigger mark room as read only when you're scrolled to the bottom and press ESC? Just brainstorming here really. 😅 |
I gave it a go and it does work well for me. I don't know if overloading a single shortcut with context-dependent functions is OK or not for general users. I do like that very much though. Managing the shortcut: case KeyBindingAction.DismissReadMarker:
// Clear all notifications if we already dismissed the read marker
if (this.messagePanel?.dismissedReadMarker() && this.messagePanel?.isAtBottom()) {
if (!!this.state.room && !!this.context.client) {
await clearRoomNotification(this.state.room, this.context.client);
handled = true;
}
} else {
this.messagePanel?.forgetReadMarker();
this.jumpToLiveTimeline();
handled = true;
}
break; And the function I added to /**
* Check if the read marker is dismissed or up to date
*/
public dismissedReadMarker = () : boolean => {
if (!this.props.manageReadMarkers) return false;
// Find the read receipt
const rmId = this.getCurrentReadReceipt();
// Is the RM already up to date?
return (rmId === this.state.readMarkerEventId);
}; Which solution do we like more? |
This new approach is exactly the functionality I would like. I would think it's OK accessibility-wise, since it doesn't depend on tapping quickly or similar, so I'm in favour. |
I'll prepare a new PR then. I imagine we need to update the shortcut screen with a new description for "Dismiss read marker and jump to bottom" and update the traslations. Let's take the discussion in the new PR. EDIT: I just realized it would have the same title so I'm reopening and I'll merge the new code in this branch. |
Signed-off-by: davidegirardi <16451191+davidegirardi@users.noreply.github.com>
74252f9
to
4dc7b58
Compare
Signed-off-by: davidegirardi <16451191+davidegirardi@users.noreply.github.com>
Signed-off-by: davidegirardi <16451191+davidegirardi@users.noreply.github.com>
Signed-off-by: davidegirardi <16451191+davidegirardi@users.noreply.github.com>
Signed-off-by: davidegirardi <16451191+davidegirardi@users.noreply.github.com>
Signed-off-by: davidegirardi <16451191+davidegirardi@users.noreply.github.com>
Signed-off-by: davidegirardi <16451191+davidegirardi@users.noreply.github.com>
Signed-off-by: davidegirardi <16451191+davidegirardi@users.noreply.github.com>
Signed-off-by: davidegirardi <16451191+davidegirardi@users.noreply.github.com>
Sending a soft nudge to check-in on the status of this PR? I'm guessing that since it has been about a year since the last discussion, there will be changes required. Thanks to all for their input and work on this! |
Neither I nor @alunturner are the right person to review this going forward, so removing our names. |
My comments have been addressed, but needs review from the Web team.
I left this rot a bit because implementing the tests required too much effort. If I remember correctly, I had to add tests for other parts of the codebase that I didn't directly touch but did not have tests. Anyhow, I wonder if this is useful now that the thread activity centre is a thing. |
I've wondered whether this is useful with the double-escape generally clearing read notices? The reason I found this issue was that I'm beginning to poke at element-hq/element-web#8541 and figured finding a stable pattern to hook into would be a good first step. Anyway, once again, thanks for the work on it everyone. |
@davidegirardi I discussed with product and I think now that thread activity has been removed from the room list, we have the activity center and also a "Mark all as read" button in the threads panel, we probably wouldn't want to make escape the keyboard shortcut. From an A11y side we can tab to the "Mark all as read" button in the threads panel, so any additional shortcut would be more for a power user use case. I think we can close this out, thanks for the contribution. |
I sometime quickly jump through rooms in a space and dismiss the read marker. Since the advent of threads, this is not enough to clear the unread state (see this discussion) so we have to use the "Mark as read" entry in the room hamburger menu.
After discussing a bit below, this PR adds an extra functionality to the Escape shortcut in the timeline. If you scroll up or there is a read marker, it behaves as it did before (scroll to bottom and dismiss the read marker), otherwise it marks the room as read.
Original PR text for context
I sometime quickly jump through rooms in a space and dismiss the read marker. Since the advent of threads, this is not enough to clear the unread state (see [this discussion](https://github.com/element-hq/element-web/issues/25437)) so we have to use the "Mark as read" entry in the room hamburger menu. This PR adds the `Alt+Escape` shortcut for it.Checklist
Here's what your changelog entry will look like:
✨ Features