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

sidebar: use native <details> for collapsible groups #3804

Open
4 tasks done
olets opened this issue Apr 18, 2024 · 0 comments · May be fixed by #3806
Open
4 tasks done

sidebar: use native <details> for collapsible groups #3804

olets opened this issue Apr 18, 2024 · 0 comments · May be fixed by #3806

Comments

@olets
Copy link
Contributor

olets commented Apr 18, 2024

Is your feature request related to a problem? Please describe.

Native <details> elements toggle on click, Enter, and Space.

The Vitepress sidebar collapsible groups toggle on click and Enter but not on Space.

The current behavior will register as "broken" for some users familiar with the native elements' keyboard behavior (✋).

Describe the solution you'd like

Switching the custom setup to native <details> would give them the standard behavior now. It would also reduce the required custom JS, improving maintainability and letting the Vitepress sidebar track any future updates to the native behavior for free.

Describe alternatives you've considered

Modifying the existing implementation to add toggling on Space would close the most obvious divergence from the native.

To me, that is a band-aid. This is an opportunity for improving accessibility. Switching to <details> would improve accessibility (better keyboard behavior, better announcing). Adding a spacebar listener to the existing setup would not.

Additional context

No response

Validations

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

Successfully merging a pull request may close this issue.

1 participant