-
Notifications
You must be signed in to change notification settings - Fork 12
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
redesign number spinner interaction #497
Comments
Interesting, maybe we should first confirm that aria-valuetext works at all with VO on the markup for AccessibleNumberSpinner <div role="spinbutton"></div> |
See phetsims/gravity-force-lab-basics#109 (comment) for a list of items we tested that didn't effect how VO reads out the value text on change. |
Yes that is a great idea! It's hard for me to navigate what is custom vs. native browser interaction when looking at |
changing priority to reflect priority of phetsims/gravity-force-lab-basics#109. |
@zepumph and I took a look at this today on a macOS device with VoiceOver. Here is the current markup for AccessibleNumberSpinner: <p id="label-377-441-454-631-632-610-609-608-594">Mass 1</p>
<div id="377-441-454-631-632-610-609-608-594" tabindex="0" aria-valuenow="2000000000" aria-valuetext="2 billion kilograms, half the size of mass 2" role="spinbutton" min="1000000000" max="10000000000" aria-labelledby="label-377-441-454-631-632-610-609-608-594"></div> We discovered that the current markup for the AccessibleNumberSpinner doesn't work with aria-valuetext or aria-valuenow in other contexts outside of PhET either. @KatieWoe helped us identify that And got similar results for each. In phetsims/gravity-force-lab-basics#62 (comment) we listed some problems with using an |
Then in the above commits @jessegreenberg and I made a few changes to our number-spinner implementation that will hopefully get things working on a mac:
Hopefully this would work on a mac now. The best way to know will be to proceed with phetsims/gravity-force-lab-basics#109 and see if that works. @jessegreenberg what do you think is next for this issue? Perhaps it should passed over to @terracoda to review the html, and maybe talk to some devs about if it is ok to have a number input in phetsims if we are preventing default? Another thought. Perhaps we don't need to prevent default. Would we ever allow this sort of keyboard input for number spinners? |
Note that currently the left/right arrow keys don't work, and they actually sound really strange on NVDA in firefox/chrome. Sometimes saying "blank" or sometimes reading the virtual cursor char by char through the aria-valuetext. I'm not sure how to get around this, since it seems to be tied to the AT. If it was the solution, I wonder if we can just not support left/right arrow interaction for this. It isn't in the spec to, and even https://rawgit.com/w3c/aria-practices/issue125-add-spinbutton-example/examples/spinbutton/spinbutton.html doesn't support it, even though the tweaker buttons are on the left and right side of the input. |
Note in https://www.w3.org/TR/wai-aria-1.1/#spinbutton that it only says we need to support the up and down arrows. @jessegreenberg and I thought that it was maybe alright that it didn't sound good on NVDA using left/right because at least the interaction still works. Perhaps that is enough, because we know the interaction is important, especially when the visual button layout is left and right of the display. |
I just noticed that although our updated solution above works nicely with NVDA and chrome. It doesn't read any aria valuetext in firefox/NVDA (instead it reads out "6000000000" -> "5000000000"). It seems like on firefox the input's value takes precedent over aria-valuetext. Even when not setting the inputValue, it reads out an empty string instead of the aria-valuetext. |
I just tested with JAWS in Chrome and aria-valuetext is coming through correctly. So aria-valuetext is only supported by Firefox on |
Everything you just said seems to be true in my test. I ran the following code with NVDA on firefox and chrome, and the top two work on both, but the bottom three only say aria-valuetext on chrome: <body>
<div tabindex="0" role="spinbutton" aria-valuemin="0" aria-valuemax="3" aria-valuenow="0">spinDiv</div>
<hr>
<input type="range" role="spinbutton" aria-valuemin="0" aria-valuemax="3" aria-valuenow="0"/>
<hr>
<input type="number" role="spinbutton" aria-valuemin="0" aria-valuemax="3" aria-valuenow="0"/>
<hr>
<input type=" text" role="spinbutton" aria-valuemin="0" aria-valuemax="3" aria-valuenow="0"/>.
<hr>
<input id="377-441-454-631-632-610-609-608-594" class="a11y-sibling" type="number"
aria-valuenow="3000000000" role="spinbutton"
aria-valuemin="1000000000" aria-valuemax="10000000000"
aria-valuetext="3 billion kilograms"
aria-label="hello slider">
</body>
<script>
const children = document.body.children;
for ( let item of children ) {
item.addEventListener( 'keydown', () => {
item.setAttribute( 'aria-valuetext', `new text: ${Math.random().toFixed( 3 )}` );
} )
}
</script> |
I just tested the current solution with VO on an iPad Air 2 and I am seeing problems there too. The @terracoda @zepumph can we use a slider for this with aria role of spinbutton? <input type="range" role="spinbutton" aria-valuetext="2 billion kilograms, half the size of mass 2" max="10" min="1"> I gave it a shot, this sound nice with NVDA in Firefox (including aria-valuetext) and works well with mobile VO. |
@jessegreenberg, I was thinking something similar, but maybe also using We don't really have a typical web <input type="range"
aria-roledescription="Mass 1 spinbutton"
aria-valuetext="2 billion kilograms, half the size of mass 2"
max="10" min="1"> @jessegreenberg, did you check if The standard keyboard design patterns are very similar for both. I would guess the touch patterns would be similar as well, but I do not know for sure. |
@jessegreenberg, oh, I see you already tested |
@jessegreenberg, I think Though I am very fuzzy on what an "abstract role" is. |
Additional comments from my email (April 23rd)
|
I just tested the following HTML with https://validator.w3.org/ and unfortnately it complains:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>title</title>
</head>
<body>
<label for="slider">My Slider</label>
<input id="slider" type="range" role="spinbutton" aria-valuemax="100" aria-valuemin="0" aria-valuenow="25">
</body>
</html> But the same HTML is OK with https://achecker.ca/checker/index.php. If the What if we just used aria-roledescription like you were suggesting @terracoda, <input type="range" aria-roledescription="spinbutton"> |
Here is GFLB using input with type range and role spinbutton Here is GFLB using input with type range and aria-roledescription spinbutton @terracoda @jessegreenberg feel free to inspect the a11y-view to get the exact HTML, but I thought it may be nice to try it out in a sim. Here is the PDOM copy from the first version: <li data-trail-id="394-458-471-648-649-627" id="394-458-471-648-649-627" data-focusable="false" class="a11y-sibling">
<p
data-trail-id="394-458-471-648-649-627-626-625-611" id="label-394-458-471-648-649-627-626-625-611"
data-focusable="false" class="a11y-sibling">‪Mass 1‬</p>
<input
data-trail-id="394-458-471-648-649-627-626-625-611" id="394-458-471-648-649-627-626-625-611" data-focusable="true"
class="a11y-sibling" type="range" aria-valuenow="2000000000" role="spinbutton" min="1000000000" max="10000000000"
step="1" aria-valuetext="2 billion kilograms, half the size of ‪mass 2‬"
aria-labelledby="label-394-458-471-648-649-627-626-625-611">
</li> To me with limited NVDA testing they sounded equally good on firefox, and on chrome the role="spinbutton" was not as good when using left/right arrow keys. |
@jessegreenberg and @zepumph, I got no errors with the W3C validator with: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>title</title>
</head>
<body>
<label for="slider">My Slider</label>
<input id="slider" type="range" aria-roledescription="My Slider described as Spinbutton" aria-valuemax="100" aria-valuemin="0" aria-valuenow="25">
</body>
</html> And @zepumph and I tested similar code. We got access to left/right arrow keys, and it sounded nice, too. I think the |
And as a design note, we can user whichever word we think is best for the control. For example, for Gravity Force Lab Basics, here are some options:
I think I like "Mass 1 mass changer" and "Mass 1 number spinner" best. |
Thanks for making testing links @zepumph, that is very helpful. I just tested dev.36 with JAWS in Chrome and it sounds great. Works with all arrow keys, I hear all alerts and aria-valuetext, and I hear the aria-roledescription! So JAWS supports the attribute. It also sounds great with mobile VO too, including the roledescription. @terracoda @zepumph I agree that seems like the way to go. In choosing a name for the role, I like "Number Spinner" best as it is most general and will work for all PhET NumberSpinners in the future. |
@jessegreenberg, that's wonderful news about JAWS and mobile VoiceOver! I was a little worried that JAWS didn't yet support aria-roledescription. Also, I like number spinner, too, as a general name. We can go with that, but keep in mind with aria-role description we have to include both the name and the function of the control in the attribute's value. We cannot just provide the function. |
Yay! I'm glad to hear that the roledescription solution is sounding well everywhere. I will put that to master and we can tweak from here.
@terracoda perhaps we should keep "number spinner" and the rest should be solved by changing the Accessible Name of the component, instead of "Mass1" maybe "Mass 1 changer" or "Change Mass 1". |
@jessegreenberg and @zepumph, I am not sure I was clear about name and function for the Due to ARIA naming algorithms, I am not sure if the accessible name provided by a For example, this first code block may be required over the second code block:
I am not 100% sure, but I think that We will need to test to be sure that the accessible name is being provided and that the API makes providing the name nice and easy when |
@terracoda I think we may be getting different results depending on screen reader. I have never heard the aria-roledescription override the accessible name for a component. In all browsers (chrome, firefox, ie, and edge) I heard the same thing for the above examples. For the first, on focus it said: "Mass 1 Mass 1, number spinner 50" and the second said: "Mass 1 number spinner 50" In master we currently have "option 2" implemented like so:
I don't remember that case, though I am learning all the time (everyday in fact) and perhaps just forgot.
@jessegreenberg I assume that here you meant that JAWS spoke the role description ("number spinner") AND said the accessible name, such that to support JAWS we don't need to add the accessible name into the role description value. Please correct me if I'm wrong. If we can't currently reproduce the case where accessible name is overridden by role description, than I think we should move forward with this solution, and can revisit if problems come up. |
@terracoda and I confirmed tonight that we do hear the accessible name, so we don't need to provide it in the aria-roledescription. @jessegreenberg over to you to confirm all looks good in JAWS before we close. |
@terracoda @zepumph that is correct for JAWS as well. |
Excellent! I'm going to close, and we will continue as we go through testing for GFLB. |
From phetsims/gravity-force-lab-basics#109
Previous work here was done in
phetsims/gravity-force-lab-basics#62. I'm unsure if this will help
Basically the issue is that on change value text isn't ever communicated to voice over when using a mac. Tested on safari (thanks @KatieWoe) and chrome (thanks @chrisklus).
There was lots of investigation done in phetsims/gravity-force-lab-basics#109 that landed us here as the culprit. When @chrisklus and I went to the scenery-phet demo for
NumberPicker
and sun demo forNumberSpinner
, we found even in the most basic examples that voiceover didn't provide the aria-valuetext. I was very out of the loop when this was originally implemented, and as a result I'm unsure if this has been around for a long time, or is because of work done in phetsims/scenery#951.Tagging @jessegreenberg so he is aware.
The text was updated successfully, but these errors were encountered: