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

Accordion: focus on closed panel child element #13

Closed
omaxel opened this issue Sep 25, 2021 · 4 comments · Fixed by #14
Closed

Accordion: focus on closed panel child element #13

omaxel opened this issue Sep 25, 2021 · 4 comments · Fixed by #14
Labels
bug Something isn't working
Milestone

Comments

@omaxel
Copy link
Collaborator

omaxel commented Sep 25, 2021

When a panel of the accordion has a focusable child element, it gains focus even if the panel is not opened. This happens because the closed panel has max-height: 0 instead of display: none or the hidden attribute.

When evaluating a solution, consider that display can't be used in animation which probably is the main reason for which max-height has been used.

@omaxel omaxel added the bug Something isn't working label Sep 25, 2021
@omaxel omaxel added this to the Accessibility milestone Sep 25, 2021
@omaxel omaxel changed the title Accordion: focus on closed tab child element Accordion: focus on closed panel child element Sep 25, 2021
@zetareticoli
Copy link
Owner

zetareticoli commented Sep 29, 2021

@omaxel please could you make an example of child focusable element and the described behavior?

I tried adding a <a href=""> link inside the first panel but I cant' reproduce any bug.

@omaxel
Copy link
Collaborator Author

omaxel commented Sep 30, 2021

Sure, follow these steps:

  • add any focusable element inside the first panel (a <button> in my case);
  • click on the header panel to expand its content;
  • click the header again to collapse it;
  • press the tab key.

You will notice that the element gains the focus and it's displayed on top of the panel header (see image below)

image

@zetareticoli
Copy link
Owner

That's bad!

@omaxel omaxel linked a pull request Oct 17, 2021 that will close this issue
@zetareticoli zetareticoli modified the milestones: Accessibility, Product Hunt Oct 19, 2021
@zetareticoli
Copy link
Owner

zetareticoli commented Oct 19, 2021

Resolved in cd7003a

@zetareticoli zetareticoli mentioned this issue Nov 11, 2021
4 tasks
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

Successfully merging a pull request may close this issue.

2 participants