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

Make Mudlet's text window readable by screenreaders #3342

Closed
vadi2 opened this issue Feb 15, 2020 · 79 comments
Closed

Make Mudlet's text window readable by screenreaders #3342

vadi2 opened this issue Feb 15, 2020 · 79 comments
Assignees
Labels
a11y accessibility enhancement

Comments

@vadi2
Copy link
Member

vadi2 commented Feb 15, 2020

Brief summary of issue / Description of requested feature:

Currently when you use a screenreader, it is able to read menus and dialogs of Mudlet - but not the actual window where the game text is displayed.

This is because menus and dialogs in Mudlet are standard Qt widgets which already have support for accessibility, whereas the game text widget is a handcrafted and very fast widget for rendering text - which does not have a11y support yet.

This issue is about adding support to it: the TConsole / TTextEdit classes.

Steps to reproduce the issue / Reasons for adding feature:

  1. Better accessibility for screenreaders

Error output / Expected result of feature

Expected result is that NVDA on Windows, built-in macOS reader, KDE and Gnome's accessibility are able to read text as it comes from the game and the widget is navigatable (as in, to go back to read text) in a standard way - as an impaired player would expect.

Thus this shall be implemented using Qt's accessibility framework as that will automatically handle the OS-specific details for us: https://doc.qt.io/qt-5/accessible-qwidget.html

Extra information, such as Mudlet version, operating system and ideas for how to solve / implement:

Mudlet 4.4.0

Bountysource

This issue will be considered closed when at least 2 visually impaired users sign off on usability.

We're new to developer bounties and this is our first foray into it - so we expect a few bumps along the road :)

@vadi2 vadi2 added the a11y accessibility label Feb 15, 2020
@svipal
Copy link

svipal commented Mar 6, 2020

Beginning to tackle this. Expect a WIP /PoC next week !

@svipal
Copy link

svipal commented Mar 30, 2020

Already said it on discord, but will say it here : Will take a looot longer than that ! :P

@vadi2
Copy link
Member Author

vadi2 commented Mar 30, 2020

@mpconley has donated some work already - see if https://github.com/Mudlet/Mudlet/compare/add-mpconleys-accessibility-work helps you out.

@svipal
Copy link

svipal commented Apr 15, 2020

Hey, sorry for all this , but work has piled up elsewhere and I've gone nowhere - I feel like it's unfair for me to claim I'm working on this and potentially reserve a bounty when I'm not. I'm abandoning this for now0, will come back in a month or so when things calm down.
Update : Will not come back

@ghost
Copy link

ghost commented Sep 30, 2020

Hate to look snide, but someone has to point the elephant in the room: you can do whatever you want with the textbox, but for a blind person, this app's value will still be outweighted by the entirety of its UI being a nightmare to use with keyboard alone. No, really, take a few minutes to memorize the relevant forms, close your eyes then try to create a script without touching the mouse. At least on Linux, you'll find that you can't even navigate them: the toolbar buttons you're so fond of don't receive focus, and there are text controls that capture the focus with no way to leave them. With scripts being unusable, the app isn't any more useful than, say, a telnet client. And you can't easily fix the usability - there's more than enough technical debt in the app to stall you for months if you try to. All in all, you should probably play to your strengths and ignore a11y altogether, lest you waste too much time on it and start bleeding the core user base.

@vadi2
Copy link
Member Author

vadi2 commented Oct 1, 2020

We're aware it's a lot of work, but internalization was a lot of work and we've achieved it - and brought Mudlet to more people out there. We, people making the client, will achieve accessibility too.

@ghost
Copy link

ghost commented Oct 1, 2020

Okay, I'll see to finishing mpconley's work then. Will talk to you later.

@ethindp
Copy link

ethindp commented Mar 23, 2021

I'll see what I can do for the output window. I'm not sure how far I'll get; I have college work to do too, but I'll give it a go.

@SlySven
Copy link
Member

SlySven commented Mar 24, 2021

🤔 I had wondered whether it would be possible to convert the TTextEdit class to render it's output in the form of a QTextDocument rather than painting out each glyph at a time with QPainter::drawText(...) onto a QWidget - that would give us automatic access to the full Qt-Screen reader interface - but at the cost of having to redo our selection and manipulation tools. We (and our Lua subsytem) uses a line + column indexing system whereas the QTextDocument class is indexed by a single integer offset (in UTF-16 / QChars) from the start. There is the QCursor class which sort of works in the middle which might help with the translation...

@ethindp
Copy link

ethindp commented Mar 24, 2021

Yeah, you'd need to redo a lot of that, but it would be worth it. The question is, what would it break?

@vadi2
Copy link
Member Author

vadi2 commented Mar 24, 2021

And how would the performance be like as well? This is the main reason we are using a custom widget to begin with.

@SlySven
Copy link
Member

SlySven commented Mar 27, 2021

Strange as it may seem I think the rendering will be faster with a QTextDocument - as it will use Qt's own (probably optimised) layout code. The difficulty is that performance is NOT (IMHO) the reason we are using a custom set of widgets - but instead it is because we want/need track the font formatting (fore/background colour, bold, italic, under/over/through-line and colour reversed) aspects for each grapheme and the only way we have to do that is via a separate TChar alongside each QChar in the text.

It ought to be possible to set/get all those aspects (apart, perhaps from the reverse one) by manipulation of the "characters" in a QTextDocument but it is not obvious how efficiently/fast that could be done in comparison with the current system which acts on the (std::deque<std::deque<TChar>>) TBuffer::buffer directly...

@vadi2
Copy link
Member Author

vadi2 commented Apr 5, 2021

Hey @ethindp, how're you coming along? Need any pointers?

@ethindp
Copy link

ethindp commented Apr 5, 2021 via email

@joecrayne
Copy link

I would like to work on this to collect the bounty. I've already looked at the code and have some ideas on design. I would avoid the accessibility framework because I can give you a better user experience by providing direct support for text-to-speech (via QT api).

@ethindp
Copy link

ethindp commented Jul 3, 2021 via email

@joecrayne
Copy link

I have it speaking text as it appears on the screen. If you press any key with the input box focused it immediately stops the text playback. The accessibility API is not going to give the right user experience for the mud sessions. First and foremost this should be playable. My thinking is that I should be able to sit with my hands on the keyboard and wear a blindfold and play the mud by listening instead of looking. A generic play/pause feature would just be an awkward encumbrance. Also, the accessibility api will not allow you to configure different voices for different hosts which is really the correct thing to do considering Mudlet allows you to connect to multiple hosts with different nationalities and languages simultaneously. TTS voices are specialized to specific locales.

So the UI I have in mind:

  1. text is automatically spoken as it arrives from the server.

  2. a keypress stops playback.

  3. only the focused mud session tab is spoken

  4. Perhaps there should be a way to restart playback for all text that has arrived since the last send. Ctrl-R or something.

  5. Each host can have a different voice configured. Switching tabs will switch voices.

I've already started but do I have the go ahead to implement this? I've never done a software bounty and want some kind of assurance that I'm following protocol and that I'll be able to collect.

@ethindp
Copy link

ethindp commented Jul 4, 2021 via email

@vadi2
Copy link
Member Author

vadi2 commented Jul 4, 2021

I agree, it's vital to use the accessibility framework for the bounty. For something that doesn't use the framework and relies on Mudlet's/Qt's built-in TTS features, check out a package made by @atari2600tim: https://forums.mudlet.org/viewtopic.php?f=6&t=23015.

@joecrayne
Copy link

I am seeing-impaired and I do have the computer read books to me for entertainment. Mudlet is similar and I think my work would have made a lot of people happy, but if you don't want it, you don't want it. The screen reader tech already works for me in Mudlet about as well as it works anywhere on my system. Have you done testing lately? QT automatically plays with it (even your custom widgets). Go ahead and link a community, but I'm doubtful there's a real mud player anywhere who would prefer the one-size-fits-all screen reader to a directly designed interface for ergonomic play.

@vadi2
Copy link
Member Author

vadi2 commented Jul 4, 2021

OK, could you put it up somewhere for us to test with?

@keneanung
Copy link
Member

Hold now! Please don't start arguing who does the right thing or not. I'm sure there is no one size fits all answer in this question, so let's not waste energy there.

I'd suggest we wait and see what the experience is in the end. There might be multiple ways to the same goal. In the end, we as core developers will need the assessment of the visually impaired community whether the result is useful.

So I'd like to point out that a PR with some kind of Screenreader Support does not automatically get the bounty. If you want to avoid moving into the completely wrong direction, intermediate versions for testing are very useful.

@atari2600tim
Copy link
Contributor

I agree, it's vital to use the accessibility framework for the bounty. For something that doesn't use the framework and relies on Mudlet's/Qt's built-in TTS features, check out a package made by @atari2600tim: https://forums.mudlet.org/viewtopic.php?f=6&t=23015.

My script is very basic and pretty much is a command line front-end for the existing TTS features paired with a one-liner trigger that speaks all incoming text. I didn't make any effort for things like navigating through the backlog, it only will read the most recent few lines. It also says extra things like "Stopping" when you stop.

If someone wanted to, with zero lua programming and just using my script together with key binding interface, one could make keyboard shortcuts that just run the various aliases I wrote. That would accomplish something that rereads recent lines and adjusts voice settings and whatnot with keyboard shortcuts.

With a minor amount of lua programming to upgrade my script, one could navigate through the backlog forward and back to read whatever piece you want. Event engine lets a script run different code between each queued string, or when switching focus between profiles. Switching tones or voices or speed of voice based on context can be done.

Long story short, my script shows the basics of what can be done with the existing features, but it is by no means utilizing everything, and not at all trying to be something enjoyable to use. I did maybe a quarter of what is in this thread. So one shouldn't look at my script and conclude that this is everything existing Mudlet can do. The program already does more than enough to enable blindfolded play.

But blindfolded play is not what people are aiming for. Users are going to want something that interacts with their own software properly instead of a substitute simulating it. A simulation can get pretty far and some will be content with just that much. Personally it fits my needs because I was curious to hear how wordy my game is, but I'm also not relying on this to actually play and I don't have muscle memory where I would expect to interact with it in a consistent way similar to other software.

@joecrayne
Copy link

Users are going to want something that interacts with their own software properly instead of a substitute simulating it.

The accessibility API, regarding the screen reader, on linux is just a layer over the more flexible speech synthesis API which is what we are talking about using. The accessibility layer only removes flexibility such as choosing the voice and locale. It's a higher level, less flexible, interface. All the software that interacts as a screen reader backend actually does so by being a speech daemon back-end. I challenge you to find any software anywhere that interoperates with the screen reader system on linux but that does not interoperate with the speech synthesis daemon for which the QT tts api is an interface to. You won't find it. Your objections are purely theoretical and wrong.

@ethindp
Copy link

ethindp commented Jul 4, 2021

@joecrayne This is incorrect. ATK is not a wrapper around Speech Dispatcher at all. ATK provides a framework that user interface toolkits and screen readers can hook into to provide an accessible and consistent user interface. On Linux and BSD (and possibly MacOS) there is, currently, only one speech synthesis daemon, however that does in no way mean another won't come along. On Windows there are at least three: SAPI 4, SAPI 5, and One Core.
This also discards the possibility of screen readers interfacing with custom speech engines, as NVDA and JAWS do. On JAWS speech synthesis drivers can utilize custom speech synthesis technologies that are not provided by the operating system or that are unavailable under SAPI or One Core. (A screen reader is also far more complicated than what you are trying to do here.)
Again, I would strongly encourage you to do one of the following:

  1. Interface with the native accessibility frameworks that are provided by the operating system unless such an interfacing would be too costly to work with, as this will provide a consistent user experience because Mudlet is based on QT already, and therefore interfacing with the native accessibility frameworks provided by the operating system will unify the user experience across the entire application; or
  2. Continue with your custom accessibility implementation but provide screen reader output via a library like Tolk on Windows, which also provides braille output, something that some blind users will wish to have because they use braille displays alongside their computers.

Again: a blindfold or listening to audiobooks does not provide the real blindness experience. It is a mockery of the real thing. I have lived with blindness my entire life, and this forum is a large community full of blind people. They will all tell you something like what I and others are telling you here. I would strongly encourage to listen to people who have actually used the technologies you are simulating instead of assuming. Unless, of course, you use a screen reader for everything you do regarding technology yourself.

@joecrayne
Copy link

On Linux and BSD (and possibly MacOS) there is, currently, only one speech synthesis daemon, however that does in no way mean another won't come along. On Windows there are at least three: SAPI 4, SAPI 5, and One Core.

My code currently seamlessly integrates two very different speech synthesis systems: espeak and festival. The "one" speech daemon on linux is actually itself a plugin architecture designed to accommodate various unrelated speech synthesis systems. My Mudlet has a speech tab that lets you select from available voices and you don't even have to know whether they are provided by espeak or festival.

The screen-reader UI is such that you have to highlight text with the mouse. This is not a very good UI for speech enabled mudding. I'm not sure how useful it is to a braille device user, but I'm willing to add a braille device support criterion if there is a specific braille device simulator for linux that you can recommend for development.

As I already pointed out, the accessibility API is already being used by QT without exception. If that is your real requirement for the bounty, then congrats, award it to yourselves because despite what the description of this ticket says, there's no widget in Mudlet that does not already support the screen reader in my tests. I can hilight text in both the main console window and in the edit box used for input, and the screen reader will read it. It occasionally gets into a bad state and misses things, but that is not Mudlet's fault. It's global behavior of the screen reader on my system (Linux) and it's another reason to avoid relying solely on ATK for catering to your sight-impaired users.

@vadi2
Copy link
Member Author

vadi2 commented Jan 10, 2022

@bauermann hey, just curious how are you going with this? Is anything being a blocker?

@ethindp
Copy link

ethindp commented Jan 10, 2022

I would be happy to test this on my machine -- I'm a full-time Linux user so would be happy to test the Linux side of things.

@bauermann
Copy link

bauermann commented Jan 10, 2022 via email

@ironcross32
Copy link

Yeah I've maintained a certain amount of curiosity about this myself.

@bauermann
Copy link

bauermann commented Jan 10, 2022 via email

@vadi2
Copy link
Member Author

vadi2 commented Jan 10, 2022

That's great! Looking forward to it.

@bauermann
Copy link

bauermann commented Jan 10, 2022 via email

@Hadi-1624
Copy link

I'm looking forward to test this on windows and provide feedback

@vadi2
Copy link
Member Author

vadi2 commented Jan 13, 2022

I've had a peek at the branch - @bauermann if you could, please merge latest branch in as it fixes a crashing issue we had at that point in time of development.

@bauermann
Copy link

bauermann commented Jan 13, 2022 via email

@bauermann
Copy link

bauermann commented Jan 13, 2022 via email

@vadi2
Copy link
Member Author

vadi2 commented Jan 13, 2022

Do whichever you're most comfortable with - in the end when we merge it gets squashed, so we can look at the commit history and clearly know when something was in or no.

@bauermann
Copy link

bauermann commented Jan 13, 2022 via email

@mohammedradwan2003
Copy link

hey,
any news about the accessibility draft
i can test it on pc
i heard about things which i wished to comment on, but i decided not to comment until the version comes out, however some interesting ideas were said, i actually used linux for 2 weeks
it is not a system for life but it is a great system
anyway, until later stay safe.

@bauermann
Copy link

Hello,

I finally sent PR #5985 with what I have so far. It’s not intended to be merged, and still has one important issue which I describe in the PR. The PR was made so that snapshot builds can be generated by the CI.

But I think there’s enough there to do some testing. I would appreciate the feedback from everybody here.

@bauermann
Copy link

bauermann commented Feb 26, 2022 via email

@bauermann
Copy link

Hello,

There’s some news from my part that will unfortunately affect my (admittedly
already slow) pace of development of this feature: I have recently started a
regular job. This means two things:

  1. I no longer have a financial interest in completing this feature. Therefore
    if someone comes along and is interested in taking what I currently have,
    complete the job and claim the bounty they should feel welcome to do so.

  2. I am still interested in seeing this feature implemented. So in the absence
    of anyone else showing up I will keep working on it. But clearly I will have
    less time to dedicate to it. If I am the one who finishes the implementation,
    then the project can reallocate the bounty money for some other purpose.

@vadi2
Copy link
Member Author

vadi2 commented Mar 12, 2022

Enjoy the new gig, and big thanks for the support so far!

@bauermann
Copy link

Thank you! And thank you for your understanding and your help with this feature.

@vadi2
Copy link
Member Author

vadi2 commented Jul 6, 2022

Linux and macOS testing for main window accessibility is ready for testing, have a look at the links in #6090 (comment). Windows is under development and will come in the future.

Please file anything you find as separate issues and thank you!

@vadi2
Copy link
Member Author

vadi2 commented Jul 12, 2022

Windows is ready for testing now as well, same link.

@Hadi-1624
Copy link

Thanks to @vadi2 his extensive research and work, I believe this is now completely done

  1. Screen readers on Windows, MacOS and Linux will automatically receive the output window and read them as it comes through.
  2. IT is now possible for screen reader users to review the output manually if they wish, as Mudlet allows keyboard navigation of the output window, so reading and navigating letter by letter, word by word, line by line and selecting text is possible
  3. Special options are added to hide blank lines for faster screen reader reading or replace them with space for screen readers to detect blank lines
  4. special option is added to change the hotkey to change the keyboard focus from input to output and back.

I am visually impaired and I use NVDA on windows 10 and can read the output fine with all the work that's mentioned being done to the client.
PS All those features are in a testing version at the moment.

@tspivey
Copy link

tspivey commented Jul 29, 2022

I haven't tested extensively, but this works on Windows, testing with PR 6187-f91e26dc. I can navigate the output window just fine, and NVDA reads incoming text.

@ironcross32
Copy link

Everything within the scope of this issue seems to be complete and working well.

@vadi2 vadi2 closed this as completed Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y accessibility enhancement
Projects
None yet
Development

No branches or pull requests