-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
improvement: a11y: arrow-key navigation for messages #4294
Conversation
21857cf
to
901f71c
Compare
6db255c
to
1d35935
Compare
1d35935
to
fe5b337
Compare
fe5b337
to
69a0780
Compare
69a0780
to
0406c54
Compare
0406c54
to
a3fcd33
Compare
a3fcd33
to
b0f7112
Compare
b0f7112
to
675c924
Compare
I would say this is almost ready to be merged, now waiting for #4376, the rest of the TODOs can be addressed in separate MRs |
7d71260
to
33b14ab
Compare
33b14ab
to
d6bd98c
Compare
d6bd98c
to
4429a87
Compare
OK, this is finally ready for review and for merge IMO. |
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.
So far all my tests were fine!
There is an issue with the reactions. You can open them with key navigation but neither select a reaction nor close the picker again. But that could go into a separate issue
What is still missing imho, is to mention the new features in the keybindings documentation. WHat is the plan about that?
IDK about that. I wouldn't call those "shortcuts". For example, WhatsApp doesn't have them listed as such. This is basically just an improvement to tab navigation, and I think using arrow keys for long lists is pretty standard. But I don't mind if we still explicitly document it. |
Closes #2141. Basically what this commit comes down to: 1. Apply `useRovingTabindex` for message items 2. Set `tabindex="-1"` on all the interactive items inside every message that is currently not the active one, so that they do no have tab stops. This appears to implement the Grid pattern: https://www.w3.org/WAI/ARIA/apg/patterns/grid/.
This is a preparation for adding `useRovingTabindex()` to them.
4429a87
to
38e6eaf
Compare
roving-tabindex-messages.mp4
Closes #2141.
Together with other previously merged MRs, closes #4127.
Basically what this commit comes down to:
useRovingTabindex
for message itemstabindex="-1"
on all the interactive itemsinside every message that is currently not the active one,
so that they do no have tab stops.
TODO:
because initially they're all active, so
tabbing to the messages list from the top selects
the first rendered one as the active one.
WIP: refactor:
useRovingTabindex
to utilize IDs #4292could help with this.
And remember that the messages list is dynamic (a new message can arrive), so simply setting the last one as active once won't cut it.
This is also not great for performance: changing
tabindex
on a bunch of messages makes them all re-render.
And otherwise, we probably want to update which one is
the active one as new messages arrive.
Perhaps we can simply implement the "End" shortcut as sort of a workaround for now: improvement: a11y: roving tabindex: End / Home #4438
jumpToMessage
calls probably ought to focus the message. For example, when jumping to a message through a click on a quote, or a webxdc info message. But not alljumpToMessage
should change focus. For example, receiving a new message shouldn't do it. This probably requires that we add afocus
parameter tojumpToMessage
. Perhaps even 2 parameters: whether to set the message as the active one in the messages list (without focusing it), and whether to focus it. But consider the fact that then the composer will be blurred and will have to be manually focused.This can be done in further MRs.
onClick
must be actual semantic<button>
s.See improvement: improve a11y #4210
for reference.
Namely, this goes for
Attachment
, and all theonClick
listeners inMessage.ts
.Update: here is an MR: improvement: a11y: turn more elements into <button>s #4429
tabindex
on<video>
and<audio>
onFocus
work? Does clicking something inside a message make that message the active one?onKeyDown
. Does pressing an arrow key when a child element is focused switch the active message?FYI This also applies to audios in gallery, see improvement: a11y: add arrow-key nav to gallery #4376
role
attributes so that things like NVDA don't override the arrow key presses to manage focus on their own. See "How do I disable NVDA's arrow key navigation".role
is also mentioned in https://www.w3.org/WAI/ARIA/apg/patterns/listbox/.The example that MDN links to uses
role="application"
on the list. I tried settingrole="application"
on our<ul>
that contains the messages and it started working, but I am not sure if this is correct.I created a separate issue: arrow key navigation widgets don't work well with NVDA #4444