Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aria-current option #43

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

johnhunter
Copy link

@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

This will make it easier to add more attributes when building the A tag while making the markup string interpolation simpler.
@johnhunter
Copy link
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.

@earlman
Copy link

earlman commented Jul 26, 2023

+1 for this! 🙂

@Dexus
Copy link

Dexus commented Sep 12, 2023

@zachleat @binyamin Please!

@binyamin
Copy link
Member

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

@johnhunter
Copy link
Author

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

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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