-
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
Improve Accessibility.js API #795
Comments
I think it will be valuable to talk a bit in person about this, but in general these feel a bit more like helper functions than abstractions. I'm not sure if this is the intended purpose, but as coded above there are multiple "order of operation" issues. What happens if I specify an accessibleName before tagName (does this code belong in invalidateAccessibleContent)? setHeadingStructure would usually be run before its parents/accessibleParents would be connected (initializating as h1), etc. Accessible names also seem more like a commonly-used part of component a11y options (where each component uses the option to properly name/label things), so I'm curious about the advantages of having a method/value for it. Header usage generally sounds nice, but (a) there are probably cases where we don't want a description, and (b) if we had two separate options ( I'd be interested in looking at example usages of the API. |
I agree with @jonathanolson's comments and questions, and additionally wanted to mention I don't really understand |
Yes, that is the direction we were going here. We considered another style that felt more like abstraction, but it felt too heavy. This approach would let us use these helper functions everywhere without requiring building blocks.
Changing
The benefit is that devs don't have to fully understand HTML and the ways in which you set an accessible name. We don't need to know that an
+1
I would be worried about a proliferation of options like this, and if we had explicit options there isn't as much of a benefit over the current API. We felt that creating sub-types felt too heavy and could make instrumentation more difficult.
We will do that too, but that will be a different issue, we wanted to have these helper functions fleshed out first so that they could be used in the instrumentation of common code components like ComboBox.
For instance, currently a11y is added to ohms-law/FormulaNode with options // a11y
labelContent: ohmsLawEquationString,
descriptionContent: ohmsLawDefinitionString,
tagName: 'div',
labelTagName: 'h3', // labels should come before other child content These would be replaced with this.setHeadingStructure( ohmsLawEquationString, ohmsLawDefinitionString ); // (name subject to change) |
TLDR: On a side note—not sure if we need an example of how nice it would be to abstract , but in phetsims/area-model-common#150 (comment):
Devs in sims need to currently know exactly how the common code item is setting it's accessible name, so that they use those specific options. |
We talked about this on 5/31/18 dev meeting: Recommendations were to continue using options pattern wherever possible. For setters |
We also talked about turning the heading method into two options, so that you don't need to have a local var reference. Thus the following methods will be part of our "api level 2" and could be overridable in all Node subtypes.
We will try to implement something before too long and get back to the devs for more feedback. |
I'll try to work up some prototypes and see how things go. Then we can get more feedback and go from there. |
I ran into a problem while implementing |
I'm going to work on some of the other setters for right now until #811 is sorted out for |
Notes from a conversation with @jonathanolson today. I think we need to think about having a
|
#814 has been completed enough to begin work on this again. Tagging @emily-phet so she is aware that I am starting on the API work again after spending the last month on scenery scaffolding and structure. |
I added help text and accessible name options in the above commits. This is a very nice approach, and I appreciate @jonathanolson's guidance in working with this. Currently there are a few todos in the code that should be decided. Also there is no support for aria-labelledby or aria-describedby within these options. This means that: node.accessibleNameBehavior = function( node, options, accessibleName ) {
options.ariaLabelledbyAssociations = [ {
otherNode: node,
otherElementName: AccessiblePeer.LABEL_SIBLING,
elementName: AccessiblePeer.PRIMARY_SIBLING
} ];
options.labelContent = accessibleName;
return options;
}; although this should work, we currently don't support overriding I also ran into similar trouble with the |
I removed a debugger statement that looked like it was pushed in this issue. |
This issue is ready to be reviewed by @jonathanolson. We have not yet worked on the "header" api, but I think that a review could happen first to make sure that scenery is working as expected. EDIT: see #855 for header api implementation and discussion. |
see #832 for parent review issue. |
This issue is labeled ready-for-review, but it's unassigned. No comments since Aug 2018, no progress on "parent review issue" since Oct 2018. @zepumph What should we do here? |
This was reviewed in #832, and the rest of the work is in side issues. Closing |
We discussed potential ways to improve the API of Accessibility.js to make it so that the developer doesn't have to worry about the HTML in many cases. We are outlining the possibilities we discussed here. These would be added to Accessibility.js so it is possible to specify these for a Node. Other options are available in the cases where we need more direct control of the HTML for accessibility. We talked about using a mixin pattern for adding these to specific nodes, but adding directly to Accessibility is much more convenient.
setAccessibleName
andsetHelpText
are meant to be explicitly overridable so that common code components can set the structure if something more complicated is necessary.The text was updated successfully, but these errors were encountered: