edenspiekermann/a11y-toggle

Document aria-own attribute

WW3 opened this issue · 8 comments

WW3 commented

by adding aria-owns to the toggle button with the div's id, screen readers will adjust the virtual buffer as if they were adjutants elements, even if they were not so in the DOM.

Toggle content

random text
another random text
Here is some content that can be be toggled visible or invisible.

Ping @Heydon and @ffoodd to have their opinion on this if they don’t mind sparing a few minutes. :)

It could be good as an option, but not as a default. WAI says that [aria-owns] should not be used if there is an actual DOM relationship.

The common use case for a toggle is a direct DOM relationship.

First rule of ARIA: if you can go with native HTML, do so.

It could be an option (like "I want to toggle that far far away thing > true"), but I'm not sure this a going to be used.

Edit: I recommend to avoid it, and to explain a direct DOM relationship is needed. And only if this isn't possible at all, then user should read about [aria-owns].

Do you agree?

And where one did use it, I'm thinking aria-controls becomes redundant?

Also, not tested but I'm wondering if it only works correctly if it is a parent to child relationship, as in Léonie's <ul> / <li> example: http://tink.uk/using-the-aria-owns-attribute/

I’d rather document it if you guys consider this appropriate than bundle it inside the lib considering how edgy it is.

+1

+2 :)

There is no need for aria-owns; the relationship is clear from aria-controls.

@WW3 can you elaborate why aria-owns is needed in this context?

I’m closing this for now. I’ll open again if necessary. Feel free to continue discussing. :)