Do not treat an avatar as a button if there is no menu #2883
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.
An avatar is treated as a button that toggles its contact menu, except when the menu was explicitly disabled. However, a menu may not be available even if it was not explicitly disabled (for example, if the avatar is for the current user). As no menu can be toggled in that case the avatar should not be treated as a button either.
Note that the menu is lazily loaded, so after you try to open the menu it could happen that there is actually no menu (that scenario can be tested by always returning a 404 in ContactsMenuController). In that case the avatar stops being a button after the user explicitly triggered it, is it needed to signal that to screen readers? Or maybe a toast should be shown in all cases, as even if you are not using a screen reader the behaviour is a bit strange. Opinions?
Another problem I noticed is that after focusing on an avatar and pressing enter to show the contact menu the focus is moved to the contact menu, but if shift-tab is used to go back to the avatar to close the menu the focus would move instead to another element (as the contact menu was appended to the end of the body). Is there any easy / quick way to solve that, or should I open a new issue?
How to test
Result with this pull request
The avatar of the other participant is focused. The avatar of the current user was skipped, as no interaction is possible.
Result without this pull request
The avatar of the current user is focused, even if no further interaction is possible