Closed zepumph closed 6 years ago
The ResetAllButton is labelled, but the label is added as an inline attribute with ARIA. The HTML looks like this:
<input id="157-218-750-751-746" aria-label="Reset All" type="button">
So no label is rendered in the DOM copy. I don't believe there is any reason to have the HTML look like this. @zepumph would you please change the HTML to look like this?
<button>Reset All</button>
Could you be a little bit more specific here @jessegreenberg. Am I updating options for the Accessibility mixin in ResetAllButton.js, or something more direct to the a11y view, because I thought that that specific view was created dynamically based on scenery.
Sure, I was envisioning updating the a11y options used in ResetAllButton so that instead of having tagName of input with an aria-label it could have a tagName of button with the label as textContent.
This will fix the problem for ResetAll (and also improve the markup), but you are correct that other elements that use aria-label will have this problem in the a11y view.
A way to improve the a11y view to fix this problem could be to detect when aria-label attribute is used on a PDOM element and add some visible label in the PDOM copy. That might be non-trivial, but haven't looked into it in depth.
I'm always stoked for a robust solution. I'll take a look at the a11y view first.
@jessegreenberg if there is an 'aria-label' attribute on a tag, is there any benefit in having content in the inner text as well?
No, we would typically want one or the other.
@jessegreenberg would you take a look at this implementation, does anything strike you as bad form?
@zepumph this is working great!
I noticed that the aria-label
is being replaced by value
, but aria-label
can be added to any HTML element, not just inputs. So to be general, I think we need a way to show the aria-label
on elements that are not input
.
Otherwise, looks great.
Just brainstorming, maybe we can use value
if an input, innerText
if the element supports inner text, and maybe something else otherwise? (if there even is another case).
@jessegreenberg what do you think about that? I'm not sure if it is full proof yet, and I didn't have a way to really test it as I couldn't find an example that made sense to me.
@zepumph, great question. It will be great to have the text of the aria-label attributes in the visual PDOM side for clarity.
That seems good to me @zepumph, thanks!
From https://github.com/phetsims/molarity/issues/37,
I noticed that none of our accessibility outfitted sims have a name/label for the reset all button, see the a11y view below for BASE (witnessed in OL as well). Is this desired, or should the reset all button have more work done to it.
In the code I see that there is an
accessibleLabel
assigned in the default options. Maybe I am not understanding fully, @jessegreenberg please explain if I am wrong.