-
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
add accessibleAttribute option to treat as javascript property vs setAttribute #870
Comments
Once we were able to add this option to setAccessibleAttribute (and have peer.setAttributeToElement support it), then mixin methods like |
Here is some documentation about this
However, I recall that we had problems with the screen reader in setting `b.setAttribute( "checked", "checked" ). If this is helpful, we should double check this. |
This leads me to believe that they should be equivalent, but we have run into problems with this in a few places (at least with AT) |
This was easy to do so I added it. I think that it is good to have to option as we have random discrepancies between spec and AT implementation. Please review @jessegreenberg. |
Thanks @zepumph, looks good and I verified it is working with the above test. |
Something about this isn't working right for MathML elements, found while looking into #895. Not sure why yet, but attributes like the hidden property are not being removed from MathML elements. |
element[ "hidden" ] = true doesn't set the hidden attribute on the element, though element.hidden still returns true. |
Can we replace element[ attribute ] = attributeValue; with element.setAttribute( attribute, "" ); |
Tests (unit, aqua) are passing so going ahead with this. re-closing. I am not sure why the second option in #870 (comment) works but the first doesn't for MathML elements, but that handles the property attributes correctly. |
Oops, getting tired...I forgot to remove the line in 35e36de. When I did that, the checked attribute broke, because we need to remove that attribute. So with this change, setting an attribute with asProperty will never remove an attribute. And it won't use the property value, should we assert that value isn't used in this case? |
I am understanding now that MathML elements don't support all attributes on HTMLElements, and don't support hidden. |
element.setAttribute( hidden, "" ); makes the hidden attribute show up on MathML elements, but the Math is still visible in the viewport, and https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute doesn't list hidden or any of the attributes of HTML elements. I am going to revert changes because handling attributes for MathML will be a larger issue. To hide MathML maybe we will have to wrap the math with an HTML element that can receive |
All changes since #870 (comment). Re closing. |
From #832 (comment)
There are potentially three different ways of setting these on a DOMElement:
It seems like screen readers and browsers treat these values differently depending on how we set them, see phetsims/sun#397. We should either support both, or decide which one is best and always use that. (I think we need to support both, likely with an option to
setAccessibleAttribute
).The text was updated successfully, but these errors were encountered: