Skip to content
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

Set aria-controls on opening button if dialog is not a direct sibling #113

Closed
MarcoHengstenberg opened this issue Sep 24, 2019 · 4 comments

Comments

@MarcoHengstenberg
Copy link

If the modal dialog is not a direct sibling of the opening button, this button needs an aria-controls attribute with a value matching the ID of the dialog.

Currently I'd set this manually but maybe it's possible to do this programmatically.

@KittyGiraudel
Copy link
Owner

KittyGiraudel commented Sep 27, 2019

Good morning Marco!

Could I ask you to provide the reference in the specifications for this maybe? I would like to read a little bit about it before implementing it. Thank you! :)

@MarcoHengstenberg
Copy link
Author

The first time I read about aria-controls was in Leonie Watson's blog: https://tink.uk/using-the-aria-controls-attribute/

Here's the spec part: https://www.w3.org/WAI/PF/aria-1.1/states_and_properties#aria-controls

There is a wonderful article by Heydon Pickering on why NOT to use it: http://www.heydonworks.com/article/aria-controls-is-poop
and the counter argument is to be found in the thread of this issue: w3c/aria#716

Especially the thread on the Github issue is the point where I think it makes sense to add the attribute with a matching value of the ID on the dialog. Using aria-expanded you'd let the user know whether the dialog is visible or not and with aria-controls you give a hint on "it's not a direct sibling to the trigger/button/link pointing at the dialog.

Makes sense?

@KittyGiraudel
Copy link
Owner

I’m coming back on this and am a little on the fence.

I don’t know whether a button opening a dialog should have the aria-controls and aria-expanded attributes. I haven’t seen them used in the context of dialogs, only toggles.

@KittyGiraudel
Copy link
Owner

I’m going to close this as I’m struggling to find relevant documentation illustrating the usage of aria-controls for a dialog. Feel free to reopen if you feel strongly about it and we can discuss the way forward. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants