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

Support message text-to-speech through browser.SpeechSynthesis API #19149

Open
sosnik opened this issue Sep 23, 2021 · 3 comments
Open

Support message text-to-speech through browser.SpeechSynthesis API #19149

sosnik opened this issue Sep 23, 2021 · 3 comments
Labels
A11y A-Timeline O-Uncommon Most users are unlikely to come across this or unexpected workflow T-Enhancement

Comments

@sosnik
Copy link

sosnik commented Sep 23, 2021

Your use case

What would you like to do?

I would like native support for text-to-speech playback of incoming text messages in the Element client.

Why would you like to do it?

I am legally blind. Text-to-speech helps me (and other people with print disabilities) keep up with chat.

How would you like to achieve it?

Element is a web app, which means it has access to the [browser.SpeechSynthesis API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis). TL;DR the API allows web pages to pass text along to whatever TTS engine is installed on the user's machine, and the OS does the rest.

You can see a working example on Discord. To enable TTS on Discord for all incoming messages, go to the User Menu -> Accessibility.

Have you considered any alternatives?

Screen readers can theoretically be used to read incoming chat, but practically this is almost impossible. A solution native to the client is best because:

  • You don't need to have the chat app open in the foreground and focused
  • The chat app can target which content needs to be read - a screenreader is liable to read everything on screen, including mouseover actions and the title bar of the application. Several times.
  • TTS integration will, naturally, target incoming messages. A screenreader is likely to read from the top of the screen, or from begining of chat history.

Additional context

I note that element-hq/element-meta#1626 suggested a specific /tts command for TTS playback of certain messages. While this has its uses (and nuisances), my suggestion is for client-side TTS playback rather than a /tts command.

@germain-gg germain-gg added A-Timeline A11y O-Uncommon Most users are unlikely to come across this or unexpected workflow labels Sep 23, 2021
@germain-gg
Copy link
Contributor

Thank you for sharing your use case here!
There's been a fair amount of work in the past to make Element usable with a screen reader. There is also an interesting room with a few folks that are involved in a11y in Element, https://matrix.to/#/#element-accessibility:matrix.org

@MadLittleMods
Copy link
Contributor

MadLittleMods commented Sep 24, 2021

I am familiar with using ARIA live regions for this kind of thing. You can define how you want the screenreader to announce new or changed elements on a page. role="log" aria-live="polite" aria-relevant="additions text" will announce new messages and edits to messages for example.

Update: It looks like we already have an ARIA live region in place but it could use some work: #10952

@sosnik
Copy link
Author

sosnik commented Sep 25, 2021

I am familiar with using ARIA live regions for this kind of thing. You can define how you want the screenreader to announce new or changed elements on a page. role="log" aria-live="polite" aria-relevant="additions text" will announce new messages and edits to messages for example.

Update: It looks like we already have an ARIA live region in place but it could use some work: #10952

I'm glad we have this, but it doesn't address "playback in the background" that is possible by using browser.speechSynthesis. Here are some concrete examples of where background TTS may be useful:

  • Idling in a support room
  • Small group discussion room with irregular participants
  • Moderation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A11y A-Timeline O-Uncommon Most users are unlikely to come across this or unexpected workflow T-Enhancement
Projects
None yet
Development

No branches or pull requests

3 participants