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

Is anchorjs working properly? #188

Open
leebrian opened this issue Mar 5, 2020 · 2 comments
Open

Is anchorjs working properly? #188

leebrian opened this issue Mar 5, 2020 · 2 comments

Comments

@leebrian
Copy link

leebrian commented Mar 5, 2020

I followed the instructions and uncommented the line in my _config.yml that I think enabled anchorJS...

anchor_js_targets: [h1, h2, h3, h4, h5, h6]

When I generate my site, I do not see the anchor links after my headers.

Looking at the generated source, I see

<script src="/source-code/assets/js/vendor/anchor.min.js"></script>

but I never see a call to anchors.add()

I might be misunderstanding how this is used. Do you have a link to a site using this feature so I can figure out what I'm doing wrong?

@ryanwoldatwork
Copy link
Contributor

ryanwoldatwork commented Sep 14, 2020

This file is where the add() is called.

I had to ensure my headers were within a .usa-layout-docs element.

Here's a screenshot of the anchor showing

anchors

@mgifford
Copy link

I think I must have missed something when I added this to the USWDS issue queue uswds/uswds#4166

Are anchor links already part of the USWDS?

I'm just coming across this now after we've developed a similar solution https://accessibility.civicactions.com/guide/tools#site-wide-evaluation

Code is up here https://github.com/CivicActions/accessibility

How do we set this up so anchor link are just part of the default for H2-H4 headings? That seems like something that would be a good default for most Jekyll pages. Maybe not all, but there is no reason that this isn't something that is controlled when defining the page type.

I'd also prefer not to use JS if there is an alternative (and there is). Anyways, would love your feedback @ryanhofdotgov

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

No branches or pull requests

3 participants