Skip to content

Conversation

@johnhunter
Copy link
Contributor

@johnhunter johnhunter commented May 8, 2022

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.

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

johnhunter added 4 commits May 7, 2022 15:47
This will make it easier to add more attributes when building the A tag while making the markup string interpolation simpler.
@johnhunter
Copy link
Contributor Author

@zachleat Is there anything required for this PR to be merged? I'll raise a PR on the docs site once this one is accepted. Thanks.

@earljman
Copy link

+1 for this! 🙂

@Dexus
Copy link

Dexus commented Sep 12, 2023

@zachleat @binyamin Please!

@binyamin
Copy link

@Dexus I don't have write access to this repository. Sorry.

@johnhunter
Copy link
Contributor Author

@zachleat is there anyone who could review the PR even if they can't merge it? It might help move things along.

Thanks.

@zachleat zachleat added this to the Eleventy Navigation 1.0.0 milestone Mar 19, 2025
@zachleat zachleat merged commit fd089d2 into 11ty:master Mar 19, 2025
@zachleat
Copy link
Member

zachleat commented Mar 19, 2025

Shipping with Navigation v1.0.0 — thank you!!

@johnhunter
Copy link
Contributor Author

Docs MR raised 11ty/11ty-website#1779

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[Request] Add rendering option for setting the aria-current attribute to eleventyNavigationToHtml

5 participants