Skip to content

Bug: Custom Container/Accordion component is not accessible and should use native <details>/<summary> elements #4846

@veloz-web

Description

@veloz-web

Describe the bug

The current implementation of the collapsible sidebar navigation uses div elements and custom JavaScript to function as an accordion. This non-semantic approach creates significant accessibility issues.

Assistive technologies, like screen readers, cannot properly interpret the role or state (expanded/collapsed) of these components. This results in a poor user experience for individuals who rely on such technology.

I propose replacing the current div-based implementation with the native HTML

and elements. This would:

Provide full accessibility out-of-the-box for screen reader and keyboard-only users.

Reduce custom JavaScript and engineering complexity by leveraging native browser behavior.

Align the component with modern web standards and semantic best practices.

Reproduction

Navigate to any page in the VitePress documentation that uses a collapsible container, such as the Vitepress Docs.

Attempt to navigate the sidebar with a screen reader (e.g., VoiceOver, NVDA, JAWS). The screen reader fails to announce it as a collapsible element or communicate its state.

Expected behavior

For sidebar to look and function exactly as it does now but with better accessibility.

System Info

JAWS, NVDA, VOICEOVER

Metadata

Metadata

Assignees

No one assigned

    Labels

    need more infoFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions