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

Prevent accordion content from being tabbable when closed #6

Closed
Flowgram opened this issue Dec 12, 2018 · 5 comments
Closed

Prevent accordion content from being tabbable when closed #6

Flowgram opened this issue Dec 12, 2018 · 5 comments
Labels
bug Something isn't working

Comments

@Flowgram
Copy link

Nice little lightweight library you've got here.

For accessibility reasons, a site should be keyboard navigable. One thing I'm thinking about is how to prevent the contents of closed accordion panels from being accessible via the tab key. This includes links, buttons, youtube embeds etc.

Then once the accordion panel is open, the user should be able to tab through everything as normal.

One solution would be to loop through all the children elements and set tabindex="-1", special consideration would need to be made for iframe contents (youtube embeds). Opening the panel would need to reverse this.

Another cleaner solution might be to set the content of each accordion panel to display:none; until it's open. This would mess with the current system for gaging the height and thus the opening animation, however, there should be ways around this.

I'd be curious to know your thoughts.

@Flowgram
Copy link
Author

Flowgram commented Dec 12, 2018

How do these guys do it? https://a11y.nicolas-hoffmann.net/accordion/?animated=1

@michu2k
Copy link
Owner

michu2k commented Dec 12, 2018

Hi
Thank you for your thoughts. First of all, demo website should be accessible via keyboard. I don't know if you weren't be able to access something via keyboard? When it comes to the bug you found, I will take a look into this problem and fix it during the weekend.

@michu2k michu2k added the bug Something isn't working label Dec 12, 2018
@Flowgram
Copy link
Author

Hi michu2k,

Thanks for getting back to me.

Yes, the accordion functionality is perfectly accessible via keyboard. It's when there are links, buttons, youtube embeds etc hidden within an accordion content that the problem arises.

Imagine this scenario: You tab onto the first accordion heading, it's not what you want so you don't trigger it to open, you try to tab onto the second heading but instead you're tabbing through links etc in the hidden content of the first element.

Thanks for looking into this.

@michu2k
Copy link
Owner

michu2k commented Dec 15, 2018

Fixed in v2.6.3

@Flowgram
Copy link
Author

Amazing, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants