Skip to content
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: arrow-key navigation for chat list #4224

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

WofWca
Copy link
Collaborator

@WofWca WofWca commented Oct 18, 2024

roving-tabindex.mp4

Implements the "roving tabindex" approach:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/Keyboard-navigable_JavaScript_widgets#technique_1_roving_tabindex.

Supersedes #4211.

This improves things, but the UX as a whole is not great yet:

  • The tab order is such that the chat list does not
    immediately follow the search field,
    so you have to tab through the other navbar items
    before you get to the chat list.
    Same for going back from the chat list to the search bar.
    This can be addressed by HTML semantics: move navbars inside the "chat list" and "chat" sections #4225
  • The initially "active" element is just the first chat item,
    and not the currently selected chat.
    I can fix it, in a separate MR. I left a TODO.
  • Since the chat list is "virtualized", the currently active element
    might get removed from DOM when the user scrolls,
    thus we lose track of the item that was last selected.
    This is pretty hard to fix. Our virtualization library does not have nice API for this, but luckily IMO this drawback is not that impactful.

Related: #2784

TODO:

If it looks and behaves good in general, I'll proceed with fixing the abovementioned issues, and adding this to other places, such as contact lists and the account list, in separate MRs perhaps.

@WofWca WofWca force-pushed the wofwca/a11y-chatlist-arrow-keys-2 branch 2 times, most recently from 42ec374 to ec7dd25 Compare October 18, 2024 17:00
@WofWca WofWca marked this pull request as ready for review October 18, 2024 17:00
@WofWca WofWca marked this pull request as draft October 18, 2024 17:00
@WofWca WofWca marked this pull request as ready for review October 19, 2024 15:42
@nicodh
Copy link
Member

nicodh commented Oct 21, 2024

Review by testing

@WofWca WofWca force-pushed the wofwca/a11y-chatlist-arrow-keys-2 branch 3 times, most recently from 17803a1 to b8dccfe Compare October 21, 2024 14:45
@WofWca
Copy link
Collaborator Author

WofWca commented Oct 21, 2024

Rebased and adjusted comments.

@WofWca WofWca force-pushed the wofwca/a11y-chatlist-arrow-keys-2 branch from b8dccfe to 2beb3ea Compare October 21, 2024 14:48
WofWca added a commit that referenced this pull request Oct 21, 2024
This is quite a significant change.
I tested a lot of placed where the affected code is used,
but still might have missed some regression.

And perhaps the behavior is still not ideal in some places,
but it's better to assess it in its final form after we add
[the roving tabindex functionality (arrow key accessibility)](#4224).
Either way this should be an improvement.
WofWca added a commit that referenced this pull request Oct 21, 2024
This is quite a significant change.
I tested a lot of placed where the affected code is used,
but still might have missed some regression.

And perhaps the behavior is still not ideal in some places,
but it's better to assess it in its final form after we add
[the roving tabindex functionality (arrow key accessibility)](#4224).
Either way I think this is an improvement.
@WofWca WofWca added accessibility enhancement New feature or request labels Oct 22, 2024
WofWca added a commit that referenced this pull request Oct 22, 2024
This is quite a significant change.
I tested a lot of placed where the affected code is used,
but still might have missed some regression.

And perhaps the behavior is still not ideal in some places,
but it's better to assess it in its final form after we add
[the roving tabindex functionality (arrow key accessibility)](#4224).
Either way I think this is an improvement.
@WofWca WofWca force-pushed the wofwca/a11y-chatlist-arrow-keys-2 branch from 2beb3ea to a563bda Compare October 22, 2024 16:15
@WofWca
Copy link
Collaborator Author

WofWca commented Oct 22, 2024

Rebased

WofWca added a commit that referenced this pull request Oct 22, 2024
This is quite a significant change.
I tested a lot of placed where the affected code is used,
but still might have missed some regression.

And perhaps the behavior is still not ideal in some places,
but it's better to assess it in its final form after we add
[the roving tabindex functionality (arrow key accessibility)](#4224).
Either way I think this is an improvement.
WofWca added a commit that referenced this pull request Oct 24, 2024
This is quite a significant change.
I tested a lot of placed where the affected code is used,
but still might have missed some regression.

And perhaps the behavior is still not ideal in some places,
but it's better to assess it in its final form after we add
[the roving tabindex functionality (arrow key accessibility)](#4224).
Either way I think this is an improvement.
@WofWca
Copy link
Collaborator Author

WofWca commented Oct 24, 2024

@r10s could check the functional aspect of this MR? I want to start adding this everywhere in the app, namely in the accounts list, contact list, for various tabs (e.g. QR reader, emoji picker), in the gallery, and, most importantly, in the messages list. In separate MRs, of course. I want a green light so that I don't waste the efforts in case the entire approach is wrong.

@nicodh and @maxphilippov could you also check if this is good code-wise?

@WofWca WofWca requested review from maxphilippov and r10s October 24, 2024 15:51
@WofWca WofWca force-pushed the wofwca/a11y-chatlist-arrow-keys-2 branch from a563bda to 2ce97e9 Compare October 29, 2024 11:28
@WofWca
Copy link
Collaborator Author

WofWca commented Oct 29, 2024

Rebased

WofWca added a commit that referenced this pull request Oct 29, 2024
This is quite a significant change.
I tested a lot of placed where the affected code is used,
but still might have missed some regression.

And perhaps the behavior is still not ideal in some places,
but it's better to assess it in its final form after we add
[the roving tabindex functionality (arrow key accessibility)](#4224).
Either way I think this is an improvement.
WofWca added a commit that referenced this pull request Oct 30, 2024
This should allow us to more easily `setActiveElement` by its
ID, without having a reference to `HTMLElement`,
e.g. we can more easily set the initial chat list item.
This issue was mentioned in #4224:
> The initially "active" element is just the first chat item,
> and not the currently selected chat.
@WofWca WofWca force-pushed the wofwca/a11y-chatlist-arrow-keys-2 branch from 2ce97e9 to 2d9214c Compare October 30, 2024 15:02
WofWca added a commit that referenced this pull request Nov 1, 2024
This is quite a significant change.
I tested a lot of placed where the affected code is used,
but still might have missed some regression.

And perhaps the behavior is still not ideal in some places,
but it's better to assess it in its final form after we add
[the roving tabindex functionality (arrow key accessibility)](#4224).
Either way I think this is an improvement.
WofWca added a commit that referenced this pull request Nov 1, 2024
This is quite a significant change.
I tested a lot of placed where the affected code is used,
but still might have missed some regression.

And perhaps the behavior is still not ideal in some places,
but it's better to assess it in its final form after we add
[the roving tabindex functionality (arrow key accessibility)](#4224).
Either way I think this is an improvement.
@WofWca WofWca force-pushed the wofwca/a11y-chatlist-arrow-keys-2 branch from 2d9214c to eaf80b5 Compare November 2, 2024 09:38
Implements the "roving tabindex" approach:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/Keyboard-navigable_JavaScript_widgets#technique_1_roving_tabindex.

Supersedes #4211.

This improves things, but the UX as a whole is not great yet:
- The tab order is such that the chat list does not
  immediately follow the search field,
  so you have to tab through the other navbar items
  before you get to the chat list.
  Same for going back from the chat list to the search bar.
- The initially "active" element is just the first chat item,
  and not the currently selected chat.
- Since the chat list is "virtualized", the currently active element
  might get removed from DOM when the user scrolls,
  thus we lose track of the item that was last selected.

Related: #2784
@WofWca WofWca force-pushed the wofwca/a11y-chatlist-arrow-keys-2 branch from eaf80b5 to 17c8184 Compare November 22, 2024 10:33
@WofWca
Copy link
Collaborator Author

WofWca commented Nov 22, 2024

I talked to @r10s privately. He's not opposed to the general direction, and said that his approval should not be a blocker. @nicodh also looked at the code.

So, let's :shipit:! It's about time.

@WofWca WofWca merged commit fb7432f into main Nov 22, 2024
10 checks passed
@WofWca WofWca deleted the wofwca/a11y-chatlist-arrow-keys-2 branch November 22, 2024 10:53
WofWca added a commit that referenced this pull request Nov 22, 2024
This should allow us to more easily `setActiveElement` by its
ID, without having a reference to `HTMLElement`,
e.g. we can more easily set the initial chat list item.
This issue was mentioned in #4224:
> The initially "active" element is just the first chat item,
> and not the currently selected chat.
WofWca added a commit that referenced this pull request Dec 1, 2024
This should allow us to more easily `setActiveElement` by its
ID, without having a reference to `HTMLElement`,
e.g. we can more easily set the initial chat list item.
This issue was mentioned in #4224:
> The initially "active" element is just the first chat item,
> and not the currently selected chat.
WofWca added a commit that referenced this pull request Dec 1, 2024
This should allow us to more easily `setActiveElement` by its
ID, without having a reference to `HTMLElement`,
e.g. we can more easily set the initial chat list item.
This issue was mentioned in #4224:
> The initially "active" element is just the first chat item,
> and not the currently selected chat.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants