-
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
[Discussion] Rethink cases for setAccessibleContent #686
Comments
@zepumph and @jessegreenberg, I need to think this over a bit to understand it. There are a few different ways to create and "accessible name" for an element, and we should be building in all the ways to do that. You need different "naming" solutions for different situations. |
@zepumph @terracoda and I discussed this today, and @terracoda said it was OK to proceed with this as long as we still support the common ways of naming elements with labels: |
All interactive elements must have an "accessible name" in the Accessibility Tree. The API should make sure all techniques for providing an accessible name are provided. The most common ways to provide an accessible name (preferably in this order) are to:
|
@jessegreenberg, @mbarlow12 and I just spent some time discussing this one. It seems to be a pretty multi-faceted api. We want to be able to handle quite a bit of flexibility in how we have a "label" (what we are calling a separate tag that goes either before or after the node's tag) or set and Accessible Name (supported examples of Accessible Name: (1) Currently we are looking into trying to be more explicit with the calls, and less clever in the mixin to make the resulting html more expected and clear for all developers. One thing we thought about was to have 2 options, instead of just We will continue discussing the next time we meet. Perhaps next Wednesday? @jessegreenberg @mbarlow12 please refine my comment as you see fit. |
Today @jessegreenberg @mbarlow12 and I spoke again, and tried to gain a better understanding of our use cases. @terracoda discussed them out nicely in #686 (comment) and we tried to go off of that. Imagine a new mixin option called
Besides case 4, we would also address the case of having another node far away label your node.
But this is used quite often in our code currently. We are wondering if:
is better/ preferred replacement. Do we want to always have both options above? What do you think about it? is
actually not a better option at all? Thanks! |
One other valid way to provide AT with an accessible name is
This may be a more concise option for case 2 in #686 (comment). |
@terracoda We also discussed possibly not supporting case 3 (using aria-label). Since it appears that aria support in general is somewhat limited, we thought it may be more straightforward to default to case 4 and explicitly delineate the desired labelling element. Also, in that vein, we're curious if the 2 html patterns (aria-label vs aria-labelledby) affect how virtual cursors move through the page. From what I understand, we currently provide the following:
And screen readers will see the heading since that is their default behavior. I'm curious as to the behavior of the following:
Will the curser pass over the h3, knowing that it provides the accessible name for the ul, and pass focus to the ul or will it behave as the former, first reading the contents of the h3 then moving to the ul—effectively repeating the ul's accessible name? |
Unassigning, to be continued next meeting. |
Initially this issue was to discuss the problematic case of accessible content that looks like:
Instead of reworking supported HTML structures and API, what if we kept a similar API but remove this confusing case? @zepumph @mbarlow12 what do you think of an API that looks like this:
While aria-labelledby and aria-describedby go through different functions. |
I like that! By doing this are we only ever setting innerHTML, or do we still support textContent? Also how to handle a situation where where we aren't trying to add a label, but just apply content to a paragraph: <p>The dog went to the park</p> |
Good point, we will still need //--------------------------------------------------------------------------
new Node( {
tagName: 'button',
innerAccessibleLabelAsHTML: '<b>My Button<b>' // will error if this node has any children
} );
// creates HTML
<button><br>My Button</br></button>
//-------------------------------------------------------------------------- |
My thought was the we treat this just like buttons, so it would look like //--------------------------------------------------------------------------
new Node( {
tagName: 'p',
innerAccessibleLabel: 'The dog went to the park.'
} );
// creates HTML
<p>The dog went to the park.<p>
//-------------------------------------------------------------------------- So that through the API the only difference between |
@jessegreenberg and @zepumph, you do want to support things like this: <p>The <b>big dog</b> went to the park and the little one stayed home.</p> But I would never want to see The difference between the |
Thanks, I meant to say
I agree, and that is one of the reasons I like the proposal in #686 (comment). This is not the "accessible name" used in the accessibility tree, this is "inner accessible content" for whatever tag name was specified with the function |
@jessegreenberg, I agree that #686 (comment) is a good approach. I would like to consider a couple changes to the list example in order to provide code validity and perhaps better semantics. The button example and the input examples make perfect sense. The list example, however, seems a little strange to me. I am not sure a paragraph would provide the best semantics of a label for a list without using Also, the generated code for a list should include at least one pair of list item tags, // creates HTML <div>
<h2>My List's Label</h2>
<ul>
<li>List item content</li>
</ul>
</div> //-------------------------------------------------------------------------- Does that make sense to you? |
@terracoda sounds good, the var listNode = new Node( {
tagName: 'ul',
labelTagName: 'h2',
accessibleLabel: 'My Lists Label'
} );
var itemNode = new Node( {
tagName: 'li',
innerAccessibleLabel: 'List item content'
} );
listNode.addChild( itemNode ); To create <div>
<h2>My List's Label</h2>
<ul>
<li>List item content</li>
</ul>
</div> |
@jessegreenberg, thanks for the example. Sounds good to me. |
@jessegreenberg, @mbarlow12, and @zepumph, content tags do not always need labels (i.e., and accessible name) in the technical sense. It would be ideal if the following HTML was supported by the API <div>
<h2>My List's Main Label (i.e., heading)</h2>
<ul>
<li><h3>Sub List Item Label (i.e., heading)</h3>
<ul>
<li>Sub list item content</li>
</ul>
</li>
</ul>
</div> Keep in mind that a heading is not always needed in content, and the following three code examples are also valid HTML 1. Nested list with a paragraph <div>
<h2>My List's Main Label (i.e., heading)</h2>
<ul>
<li><p>Sub List Item Label</p>
<ul>
<li>Sub list item content</li>
</ul>
</li>
</ul>
</div> 2. Nested list with a formatting tag <div>
<h2>My List's Main Label (i.e., heading)</h2>
<ul>
<li><strong>Sub List Item Label </strong>
<ul>
<li>Sub list item content</li>
</ul>
</li>
</ul>
</div> 3. Nested list with no tag at all <div>
<h2>My List's Main Label (i.e., heading)</h2>
<ul>
<li>Sub List Item Label
<ul>
<li>Sub list item content</li>
</ul>
</li>
</ul>
</div> OOPs @jessegreenberg, @mbarlow12, and @zepumph, I posted too soon. |
Re @mbarlow12 #686 (comment), I agree that code is efficient and is valid. My understanding is that it is interpreted the same as <label for="myInput">My Input's Label</label>
<input id="myInput" type="something"> Though, I imagine their could be subtle differences in how focus is managed by browsers between the two code examples - especially when using the cursor keys. |
@terracoda that structure is definitely supported in this proposal. "3. Nested list with no tag at all" is what is currently NOT supported by the proposed API for the same reason as your comment #686 (comment). When we discussed this before we agreed that it isn't necessary to support mixing |
OK, sounds good. We can probably live without option 3. Nested lists with no tag at all. |
Adding to a11y dev meeting just to get refreshed on this, and to make sure I understand how to proceed. |
In the keyboard nav meeting today, we (@terracoda leading) discussed the need for multiple |
Marking as high so that we make sure to get to it tomorrow. |
We would like to reconsider having both |
@zepumph found this link https://jsperf.com/innerhtml-vs-textcontent, testing the performance of textContent vs innerHTML. Here are the results running on @jessegreenberg's machine.
@jonathanolson we are trying to decide if this makes it worthwhile to support both |
Depends on how many times this will need to be called per frame, and if the performance is worse on iOS/etc. Also depends on convenience. If it takes 0.01ms for a 16.7ms budget for each frame, and is only called a few times per frame, I'm definitely not concerned about performance. |
We discussed the If there are problems with performance in the future, then there are other pieces of the mixin that can (and should eventually) be updated. One of these that was discussed was batching |
We finished discussing the way that we want the new A11y API to look in scenery:
Closing, to be implemented in #748 |
Great work everyone! This was a honker. |
Great work @zepumph, thank you for taking the lead on this. |
@zepumph can Scenery handle two id's for an |
It cannot, but we have not updated the |
@zepumph, thanks, I needed the issue number. |
@zepumph found a few issues with
setAccessibleLabel
andsetAccessibleLabelAsHTML
. The default behavior for these functions is to set the label value as theinnerText
orinnerHTML
of the node. This is confusing because for nodes with children that also have accessible content it will produce html likeMore intuitive default behavior would be the following (the label should be outside of the child content):
With
setAccessibleLabelAsHTML
it is easy to blow away accessible content of child nodes because the default is to set the innerHTML of the Node's DOM element. (Very scary!)We would like to change the behavior of setAccessibleLabel to only set content for a label element (maybe default to
p
) or set the content foraria-label
. New functions likesetAccessibleInnerHTML
andsetAccessibleInnerText
will explicitly set theinnerHTML
orinnerText
to handle cases likeThis change would likely make this kind of mix of inner content unsuported:
In general I think this is OK, I can't think of a case where this would be better than
But @terracoda we wanted to check this limitation with you before continuing, does this seem OK?
The text was updated successfully, but these errors were encountered: