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

Keyboard focus jumps when opening accordion section #626

Closed
matteason opened this issue Sep 8, 2023 · 2 comments · Fixed by #735 or #805
Closed

Keyboard focus jumps when opening accordion section #626

matteason opened this issue Sep 8, 2023 · 2 comments · Fixed by #735 or #805
Labels
bug Something isn't working

Comments

@matteason
Copy link

Version

@nuxt/ui: v2.8.0
nuxt: 3.7.1

Reproduction Link

https://ui.nuxt.com/elements/accordion

Steps to reproduce

  1. Tab to the 'Getting started' accordion section heading in the first example
  2. Press the enter key or spacebar to collapse the accordion section
  3. Press it again to expand the accordion section
  4. Observe that focus now jumps to the last accordion heading in the list

What is Expected?

Focus should remain on the same accordion heading when the section is expanded or collapsed

What is actually happening?

Expanding an accordion section moves focus to the last accordion heading (except when you expand the last section, in which case focus moves to the second-to-last heading). This is an accessibility issue; the user will not expect focus to jump from the section they've interacted with

Note that the focus also moves if you use the mouse to expand the section, but it's less visbile because focus styles are only used when interacting with the keyboard

Screen recording of the issue described above

@matteason matteason added the bug Something isn't working label Sep 8, 2023
Copy link
Contributor

Haythamasalama commented Sep 23, 2023

Indeed, there is an issue with the closeOthers. After disabling it, it works on https://github.com/nuxt/ui/blob/dev/src/runtime/components/elements/Accordion.vue#L103

@matteason
Copy link
Author

@benjamincanac Can this issue be reopened please? The pull request that's been merged doesn't solve the issue raised - see #735 (comment)

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
2 participants