-
Notifications
You must be signed in to change notification settings - Fork 7
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
Enhancement: add options to hide the link altogether, and set the ID on the heading instead of a separate <a> #21
Comments
Thanks! Anchors 2.4.0 (Craft 3) and 3.1.0 (Craft 4) have been released with a fix for this. |
Thanks @brandonkelly, I upgraded to 3.2.0 but the anchor element is still there, even tho my config is:
I couldn't see any new parameter in the documentation, to remove the anchor link altogether. Am I missing something? Also the I really think the documentation is missing the new configuration options to change the behaviours I was describing here? |
Sorry I had a look at the PR and none of these changes address the 2 issues I mentioned. The The expected output when disabling the anchor link would be: At the moment, I can use |
Hi, accessibility improvement has been actioned (the unnecessary tabbing step was removed). That’s why we now have the If you set the I don’t believe we can always add the ID to the heading tag itself because what if that heading already has an ID? Please note that you can also tap into the [plugin api] (https://github.com/craftcms/anchors#plugin-api) to enhance the functionality to match your specific needs. |
Well, if the heading already has an id, you don’t have to generate one and you can use it in the anchor link ;-) |
Doh, apparently, I like to overcomplicate things... |
All good @i-just , thanks for looking into this! |
Hi, @uandco; we discussed this internally and decided that not rendering the anchor at all is out of scope for this plugin. As mentioned before, you can have a look at leveraging this: https://github.com/craftcms/anchors#plugin-api to achieve what you’re after. In terms of setting the |
Thanks @i-just , the anchor is not a big deal, there's CSS workarounds to hide it altogether or only show it to screen readers, etc. Adding a new config option to set the |
@i-just I just saw the |
Having a link in each heading, even with empty text, creates unnecessary tabbing step when navigating with the keyboard.
It would be great to have an option that disables the
<a class="anchor">
element altogether.Another option to set the
id
attribute on the heading itself would be great as having an extra element before the heading can cause styling issues, for example when using:first-child
. I know I could use a specific class on the anchor and change toh2:first-child, a.specific-class:first-child + h2
but that's a massive technical debt while theid
attribute should have been on theh2
to start with.There might be other accessibility considerations to take into account to improve the plugin, this is a good read.
The text was updated successfully, but these errors were encountered: