eleventy-navigation icon indicating copy to clipboard operation
eleventy-navigation copied to clipboard

Add aria-current option

Open johnhunter opened this issue 2 years ago • 5 comments

Fixes #14

It adds a useAriaCurrentAttr option so that an anchor matching the activeKey will have an aria-current="page" attribute (see more details here).

Example Nunjucks navigation rendering:

{{ collections.all | eleventyNavigation | eleventyNavigationToHtml({
    activeKey: eleventyNavigation.key,
    useAriaCurrentAttr: true
  }) | safe }}

The PR also includes a refactor to make adding tag attributes a bit simpler.

  • [x] Changes have test coverage
  • [x] Have verified works in an Eleventy site build
  • [ ] Documentation updated

johnhunter avatar May 08 '22 11:05 johnhunter