Improve accessibility by adding label to Anchor links.

I ran Lighthouse on just-the-docs and noticed the anchor links
were missing a "discernible name".

This adds aria-labelledby to the header element to improve these for
screenreaders.
This commit is contained in:
Mike Coutermarsh 2020-07-04 14:28:52 -07:00
parent 50d727871e
commit bf31b8b9a0
No known key found for this signature in database
GPG Key ID: 45391430D7808AFE
1 changed files with 2 additions and 2 deletions

View File

@ -64,7 +64,7 @@
{% capture anchor %}{% endcapture %}
{% if html_id and headerLevel >= minHeader and headerLevel <= maxHeader %}
{% capture anchor %}href="#{{ html_id}}"{% endcapture %}
{% capture anchor %}href="#{{ html_id}}" aria-labelledby="{{ html_id}}"{% endcapture %}
{% if include.anchorClass %}
{% capture anchor %}{{ anchor }} class="{{ include.anchorClass }}"{% endcapture %}
@ -97,4 +97,4 @@
{% endcapture %}
{% capture edited_headings %}{{ edited_headings }}{{ new_heading }}{% endcapture %}
{% endfor %}
{% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }}
{% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }}