Skip to content

USWDS - Feature: Add customizable data- attribute for in-page nav to specify which heading tags should be used #5030

@mitchmoccia

Description

@mitchmoccia

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

Currently, the in-page nav component searches a page for h2 and h3 tags and dynamically builds the nav links based on the content of those tags. It also makes h2-based, created links bold while making h3-based links normal weight.

Describe the solution you'd like

We could offer a way to easily customize the way in-page nav searches for page headings to dynamically build the navigation block. What if a developer only wanted to use h2 tags? e.g.:

data-headings="h2"

If no data- attribute is present, the default one in the JS would be used.

Describe alternatives you've considered

No response

Additional context

No response

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions