Skip to content

Use actual anchors for TOC links for better accessibility #1090

Open
@donysukardi

Description

@donysukardi

Currently the TOC in the sidebar uses <label> and the route change is applied on click. It'd be better if the links are actual anchor links for accessibility reason. Users can then share direct links to different parts of the documentation.

image

The issue I'm facing currently is that with SSR and when the site is hydrating on the client side, the TOC links are not operational as the event handlers are still being registered.

With the change proposed above, the site would be still operational even without JavaScript.

Here's an example on how Slate does it - https://slatedocs.github.io/slate

Metadata

Metadata

Assignees

No one assigned

    Labels

    a11yAccessibility-related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions