improvement: a11y: arrow-key navigation for messages #4294
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
2024-10-30-0C6LIUUYry.mp4
Based on #4291
Closes #2141
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.
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.
jumpToMessage
calls 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.This can be done in further MRs.
onClick
must be actual semantic<button>
s.See improvement: improve a11y #4210
for reference.