2021-03-04 19:53:08

Hi ALl,

I am working on contributing to some open source projects written in Java, and ran into some accessibility issues I'd appreciate help with. I'm trying to figure out how Java and the Java Access Bridge interface with NVDA, as follows…

One of the projects I'm working on is an implementation of Magic: The Gathering. I did some kind of hackish accessibility already, basically I needed a way to tell the player that a card was tapped, among other states, which is a thing conveyed visually for sighted people and will make sense to anyone who has played the game before.

I ended up using the AccessibleDescription property to do this, which isn't ideal, and have been trying to figure out an alternative. I thought that using Java's AccessibleState class might do the trick. I created a custom subclass for AccessibleCardState, since none of the pre-existing states seemed to quite fit what I needed to convey.

The state is being passed through  the Java Access Bridge, but NVAD isn't using it to describe the card in the way I thought it would. I was expecting it to say something like "CardName Tapped," in the same way it might say "Checkbox checked."

My code in progress can be found here on Gitlab. I added a couple classes to the bottom of the CardPanel.java file, which is where the bulk of the logic around displaying cards takes place.

If I'm missing something about the way states work, or how Java interfaces with NVDA, I'd love to be enlightened. I'm certainly willing to work with my previous solution of setting the AccessibleDescription, but thought states were closer to how the accessibility API is intended to be used.

Thanks all.

2021-03-04 20:22:38

You should go to the NVDA mailing lists.  Doubt anyone here is going to have anything even close to good info.

it's worth knowing that java accessibility is terribly buggy.  We've only had the JAB installing reliably for maybe the last 2 years out of the 10+ that it's been around for example.  You will be able to get things working, but "this doesn't work how I think" may very easily be "I found yet another bug".  Oracle didn't do things as they should, tried to reinvent the wheel, etc etc etc. and here we are.

My Blog
Twitter: @ajhicks1992

2021-03-10 13:34:09

@1 I tried to do the same thing, and the conclusion I reached was the same as you, the states are hardcoded into NVDA, and if you create a new one it will ignore it because it can't translate it to a NVDA state, even though it's being sent from the access bridge.
If you want to fix it with a state, you'll need to use a state that NVDA can translate, you can see a list of translatable states on this file https://github.com/nvaccess/nvda/blob/m … _init__.py
On this file there's a variable JABStatesToNVDAStates that contains the translatable states.
Hope it helps a bit.

2021-03-10 21:45:54

thggamer,

THanks. This is about what I presumed. I'll have a look around that file and see if I can find out anything else going on. I'm surprised to see so few of the states mentioned.