-
Notifications
You must be signed in to change notification settings - Fork 126
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
Support an attribute like aria-posindom that lets us modify a11y tree without modifying DOM order #1021
Comments
This sounds very similar to setting tabindex to positive integers, which is historically problematic. <button>very first button</button>
<div>
<button aria-posindom=1>first button</button>
<button>middle button</button>
<button aria-posindom=0>second button</button>
</div> That said, I still think the idea has merit. Currently, some browsers work around CSS reordering, and some don't, making for an inconsistent cross-browser experience. Something like what you are suggesting could help tighten up the spec. However, it would have to be carefully and fully specified. For example, I think it should only apply to elements within the same parent/ancestor, so that it is limited in scope. It might even be helpful for the parent/ancestor to inform the browser that (some of?) its children/descendants will have their accessibility tree order specified. Points to consider and clarify:
|
Potentially related to this is the use of aria-owns which may or may not modify the accessibility tree depending on the user agent. Last time I checked, Gecko respects aria-owns to reorder the tree; WebKit and Blink do not (this assertion needs sanity checking). |
Blink reorders the tree from aria-owns. |
Confirmed. I stand corrected. Thanks @aleventhal! |
So test case:
When I look at the resulting accessibility tree for both Blink and Gecko, I see the object with the
@carmacleod would that solve your use case if WebKit also did it? If so, yay. If not, what else do we need to handle? |
I did a slightly different version of this to match what's in the opening report:
And I get the same results as in the previous comment, namely the children are reordered. |
This attribute would put the burden of fixing tab/a11y order on authors, and I don't think that's a good thing to do. I'd be curious to see some examples where the disconnect is happening in the whild, and where rewriting the DOM would be too expensive to be feasible. If there is a problem to solve, it seems to me that browsers should be where that happens. It should be possible for browsers to create a tab/a11y order that matches the visual order of content, where it's been rearranged using one of the relevant CSS properties. Firefox did this to some extent when flexbox was released, though they later reverted that capability unfortunately. A new property would be needed to let authors declare whether the items in the container should have their tab/a11y order rearranged to match the visual order, because there are times when the disconnect is useful. But a single CSS property that is applied to the container, would be much easier for authors on the whole. |
Hi @LJWatson
I looked into this, and I'm afraid that ship has sailed.
Yes, I think it would. We could add guidance (in ARIA and/or APG) strongly recommending that authors always ensure that the source order follows the visual order, but if they really need to reorder visually (and if for some reason, they can't reorder the DOM), they should match the order using @cookiecrook Do you foresee a problem adding "aria-owns reorders tree" capability to WebKit? For a very quick test, paste the following line into the browser's URL bar: data:text/html,<div aria-label="buttons" role="group" aria-owns="2 1"><button id="1">foo</button><button id="2">bar</button></div> In both Blink and Gecko, the accessibility tree is reordered as 'bar', 'foo'. |
This is certainly not going to be in 1.3 - adding the 2.0 milestone for now. |
@cookiecrook where is webkit on tree reordering with aria-owns. Can we close this if webkit has moved forwards? |
@jnurthen wrote:
|
In some cases, we would like to avoid modifying DOM order to make sure accessibility tree is in correct shape.
There might be a CSS rule that would break if the DOM order has changed. Attributes like aria-owns are good because it lets us modify the accesibility tree without having to modify the DOM order.
But to give developers full control, it would be nice if something like below existed.
And Chrome accessibility tree would be something like below:
The text was updated successfully, but these errors were encountered: