Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Accessibility: Improve Voiceover #12189

Closed
wants to merge 14 commits into from

Conversation

akirk
Copy link
Contributor

@akirk akirk commented Jan 30, 2024

Improves Voiceover through a dedicated aria-label:

message-navigation

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

Signed-off-by: Alex Kirk <[email protected]>


Here's what your changelog entry will look like:

✨ Features

  • Accessibility: Improve Voiceover (#12189). Contributed by @akirk.

@florianduros
Copy link
Contributor

Hi!

Thanks for the contribution. Can you fix the typescript, lint and tests errors to make the CI happy?

@florianduros
Copy link
Contributor

@akirk Hello! The CI is in failure. Do you still want to work on this PR? Thanks

@t3chguy
Copy link
Member

t3chguy commented Mar 8, 2024

@akirk any chance of splitting out the improve voiceover changes into a separate PR to simplify concerns for review?

@akirk
Copy link
Contributor Author

akirk commented Mar 8, 2024

I tried to address the lint problems, I am not sure it worked, npm run lint:fix started to work on code that I didn't touch so I tried to omit it.
For types npm run lint:types complains about lots of files that I didn't touch either. Could you give me a few pointers in how I could address these issues?

@t3chguy
Copy link
Member

t3chguy commented Mar 8, 2024

I tried to address the lint problems, I am not sure it worked, npm run lint:fix started to work on code that I didn't touch so I tried to omit it.
For types npm run lint:types complains about lots of files that I didn't touch either. Could you give me a few pointers in how I could address these issues?

Could you share examples of changes and errors respectively

@akirk
Copy link
Contributor Author

akirk commented Mar 8, 2024

any chance of splitting out the improve voiceover changes into a separate PR to simplify concerns for review?

Ok, I'll create a new PR and remove the keyboard nav changes from this PR.

@akirk akirk changed the title Accessibility: Add Keyboard Navigation for Messages and Improve Voiceover Accessibility: Improve Voiceover Mar 8, 2024
@akirk
Copy link
Contributor Author

akirk commented Mar 8, 2024

The new PR for the keyboard navigation is #12328.

@akirk akirk force-pushed the improve-message-voiceover branch from b44734c to 4bf8d18 Compare March 8, 2024 13:41
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous comment re other Event renderers still stands

@@ -102,6 +103,7 @@ function MemberAvatar(
}
: props.onClick
}
aria-label={name ? name + ". " : ""} // Full stop adds a pause between the name and the appended message.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment doesn't make much sense, and points out that not all consumers of MemberAvatar may have any appended message so maybe another solution is desired which is more respective of the plethora of places a MemberAvatar may be used

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried something in 90ea6c4

Basically the aria-label for the component itself is just the name (without dot).
In EventTile, we override the accessible name of the DIV that contains the avatar to be name + dot.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That won't work because giving a div both a role and a negative tab index would be yet another accessibility violation. I've added a prop to conditionally add the . to the aria label.
I'm not entirely convinced that this is really useful. Testing with Orca, I don't really see a difference with/without the dot.

@florianduros florianduros mentioned this pull request Apr 12, 2024
4 tasks
Copy link
Contributor

@MidhunSureshR MidhunSureshR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to break for events sent by the user

@@ -612,6 +612,7 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
}

let widgets;
const id = "mx_EventTile_content_" + mxEvent.getId();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getId() here will actually return the local id but will return the remote id from sync elsewhere:

image

Probably best to use mxEvent.getTxnId() ?? mxEvent.getId()

@MidhunSureshR
Copy link
Contributor

I don't think this approach is viable:

  1. Not sure if we should worry about the intrinsic behavior of screen readers i.e when and how much they pause. Testing with orca, I don't even get a pause.
  2. An event can be rendered twice - once in the main timeline and then again in the thread panel. Assigning an id in this fashion would mean multiple elements have the same id.
  3. Some message bodies already render with an id eg: MLocationBody

I think something like e30354b is probably what we want but we'd have a function that takes an event and spits out some accessible text:

"aria-label": this.props.mxEvent.sender.name + '. ' + getAccessibleTextForEvent(this.props.mxEvent),

I'm inclined to close this PR for now.

@MidhunSureshR
Copy link
Contributor

Closing for the reasons mentioned in #12189 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements Z-Community-PR Issue is solved by a community member's PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants