magefree / mage

Magic Another Game Engine
http://xmage.today
MIT License
1.88k stars 767 forks source link

XMage accessibility issues for blind players using screen readers. #5920

Open Hadi-1624 opened 5 years ago

Hadi-1624 commented 5 years ago

Hello. I'm visually impaired and use screen reading software and the keyboard only to work with my computer. I am using windows 10 and a free screen reader software called NVDA. Sorry for the long post, I've recently stumbled into XMage and extremely delighted to find out that a huge portion of the software is accessible, keyboard navigation works in a lot of the areas by using tab and shift tab and my screen reader is able to read the UI elements because they are computer generated text. However i can't play because of some accessibility major issues that exist at the moment. To clarify this post, i'm going to list the parts that are accessible then i will list the problems that prevents me from playing.

The parts that i am able to access using tab and shift+tab, and arrow keys include working with the launcher 100%, running and joining my local server, the deck editor seems almost 100% accessible, importing decks, creating a new game and adjusting the game settings e.g. adding AI, and starting the game. when the game is in progress, the chat output, the game log which describes the events that happens, the button actions that are available, such as done, yes and no, keep or mulligan. The panel that shows the stats such as lifepoints and mana are accessible using advanced screen reader functions and not tab and shift tab.

I'm going to list my issues that is preventing me to play the game, Please advise if it's required to post these as different issues on github.

  1. I can't seem to be able to put my focus onto my hand with the keyboard and navigate it with the arrow keys. Because of this, I can't see my hand and i can't use any of my cards using the keyboard. I assume that i also can't focus onto my graveyard as well, to be able to see the cards in there.
  2. I also can't focus into and read the battlefield, so i wouldn't be able to see what is in there or target them.
  3. The phase panel that shows the phases, such as upkeep, draw, combat, is accessible using advanced screen reader functions, but i can't find out that which turn is currently active, I think this is indicated by color or an image, I believe this could be fixed by adding an appending text to the current active phase, e.g. main phase1 (active).
  4. This is a lesser issue compared to the above ones, the part where the card info is shown when it is selected is also not accessible by pressing tab and shift tab. It is indicated by a button when focused onto, but unlike the game log and the chat log, I can't focus onto it and use my arrow keys to read the text.

Would there be any chance of perhaps making an alternative list view of the hands and the battlefield that the keyboard could interact with? Or maybe a way to use the console to issue commands to get a list of my hand/graveyard/battlefield, and be able to target cards?

Hadi-1624 commented 5 years ago

I think i'm very close to be able to play magic for the first time as a visually impaired person, I always wanted to play this game online since i can't find a community near me to play with me. I'm going to let other blind players know so they also can contribute or suggest better ideas.

spjspj commented 5 years ago

Wow man, that's awesome that you found it. There's a json type output log that's produced as well (but it may just be similar to the existing outputted log).

Hadi-1624 commented 5 years ago

I would like to add. There's a function used by my screen reader called Optical character recognition where it takes the entire window and begins recognizing all the text including the ones that are images and graphical and the ones that are out of the keyboard focus reach. I tried to use it on the game window but the cards are all over the place and i was able to find two of my cards and click on them, but not more than that. I also once accidentally found a creature that my opponent put down and clicked on it but couldn't really go further with it.

JayDi85 commented 5 years ago

It's can be improved by Java Accessibility API.

As example: cards on battlefield/hand/windows uses popup tooltip to show card's info and it works with mouse only (you can move mouse over card to see popup info and use mouse wheel to change from text to image and vice versa). But it's can be extra description for that objects:

aJComponent.getAccessibleContext().
    setAccessibleDescription(
    "Clicking this component causes XYZ to happen.");
Hadi-1624 commented 5 years ago

IS there a way to make the hand and the battlefield visible to the keyboard so it could be accessed by keyboard navigation and not mouse only?

JayDi85 commented 5 years ago

Current version doesn't support keyboard navigation at all. All cards are not focusable. All game panels are not focusable and bugged.

I'm tested some code and it works fine (focusable cards and navigation by tab button between cards). But it needs much more fixes and tests.

My test code example for Mage.Client\src\main\java\org\mage\card\arcane\CardPanel.java:

    public CardPanel(...) {

        this.setFocusable(true);
        this.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(FocusEvent e) {
                LOGGER.warn("focus gained " + getCard().getName());
            }

            public void focusLost(FocusEvent e) {
                LOGGER.warn("focus lost " + getCard().getName());
            }
        });

P.S. XMage have full info about cards, playable abilities and choosable targets. In theory there are no needs in graphic interface at all (e.g. command line client possible). That's "client" can be implemented by chat window. Commands example:

Hadi-1624 commented 5 years ago

To be able to test your code, do i need to download the source of the client, put your code in and compile it for myself? I've never done this before so have to google if so.

Very amazing that the chat window could be used to interact with the game! I'm super excited.

JayDi85 commented 5 years ago

Nope, that's code for me and other devs. It's not from game client. Same for chat commands -- current version supports only limited amount of commands like /FIX. But it's possible to add more commands in the feature (in fact, the cheat engine for cards testing has a similar command line system already).

Hadi-1624 commented 5 years ago

Oh alrighty. I can't play at the moment do to the focus bug, but i will watch this topic and in case there was a testing client I am happy to test it with my screen reader.

Hadi-1624 commented 5 years ago

I forgot to mention. while you're using tab to cycle around the UI elements your focus will get stuck in the table that has your name on it and the type of game and the time that game has started. if you keep tabbing your focus will be cycling inside that table and won't go to the other sections. press control+tab to get out of that table when that happens.

sjrivers commented 5 years ago

Made an account to say thanks for working on this I used to play when i was sighted at my parents house with my friends and family we had a lot of good times I can't play anymore. hoping that i can play with this software one day. I will even show it to my friends, will get them to also play with me.

Noseme commented 5 years ago

Saw your post on ag forum signed up on github to be notified @h-rezaei do you know of any workarounds to select the cards, perhaps by using golden cursor to define hotspots on the screen?

Hadi-1624 commented 5 years ago

Unfortunately no. I have tried to define hotspots but it is hard to tap in cards that are stacked on top of each other, and because NVDA won't read the small text that indicates the card's name, it's not reliable to use golden cursor. Hopefully the developers will fix the keyboard focus in the future so we can start from there. Everything would be easier after that improvement. Then we could simply focus on the cards and use optical character recognition to read the card's popup info!

Hadi-1624 commented 5 years ago

@JayDi85 sorry to bother you again. Is it possible that you implement an experimental version of keyboard navigation on cards for the developer version of xmage, whenever you have time to do so?

JayDi85 commented 5 years ago

Yes, I will add some improves. After that will post new version here for tests (on beta server).

Hadi-1624 commented 4 years ago

Hi there Has there been any improvements to xmage's accessibility so far? cheers

BlindGuyNW commented 4 years ago

Hey,

Just popping in here to say that I, too, am very interested in possible accessibility for this game. I have downloaded the XMage launcher and am curious about the possible command line support and/or keyboard navigation. If this can be improved a bit i would love to play, as I"ve always been curious about Magic for years.

Hadi-1624 commented 4 years ago

@JayDi85 JayDi85 Do you think it's possible to add some sort of hidden text / alt text to cards? using built in screen reader functions, i am able to read all parts of the game, except the cards. no matter how, but i can't seem to be able to read the card texts with my screen reader, but the mana stats, life points, those are all readable

BlindGuyNW commented 4 years ago

I'm going to have a poke at trying to get this working, or at least closer to working :) I've been working on some other Java and Magic-related stuff of late, so this looks fairly promising. I'm hoping that I can use the accessibility API to handle most things, since all the card information is already available.

Noseme commented 4 years ago

I have forgotten about this, excited for any improvements. Where can we follow your work, here on github?

BlindGuyNW commented 4 years ago

Hi,

My plan is to submit everything I do back to the main repository, yes. I hope that this will be able to entertain the many totally blind Magic fans, eventually. For now I’m just getting familiar with the codebase and looking into what sorts of things i need to do.

On Jul 7, 2020, at 10:04 AM, Noseme notifications@github.com wrote:

I have forgotten about this, excited for any improvements. Where can we follow your work, here on github?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/magefree/mage/issues/5920#issuecomment-654998845, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANWY4ZLP3OCULXXENER2CDR2NIQBANCNFSM4IHQTQCQ.

Hadi-1624 commented 2 years ago

Hi there, was there any improvement to this since couple of years ago?