toc: add aria-label for accessibility reasons

- fix: Links do not have a discernible name
This commit is contained in:
Aditya Telange 2020-11-06 10:58:23 +05:30
parent 795c06b2cc
commit 5264c7011e
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77

View File

@ -62,10 +62,10 @@
{{- end -}}
{{- end -}}
<li>
<a href="#{{- $cleanedID -}}">{{- $header | safeHTML -}}</a>
<a href="#{{- $cleanedID -}}" aria-label="{{- $header | plainify -}}">{{- $header | safeHTML -}}</a>
{{- else -}}
<li>
<a href="#{{- $cleanedID -}}">{{- $header | safeHTML -}}</a>
<a href="#{{- $cleanedID -}}" aria-label="{{- $header | plainify -}}">{{- $header | safeHTML -}}</a>
{{- end -}}
{{- end -}}
<!-- {{- $firstHeaderLevel := len (seq (index (findRE "[1-6]" (index $headers 0) 1) 0)) -}} -->
@ -81,4 +81,4 @@
{{- end -}}
{{- end -}}
</ul>
{{- end -}}
{{- end -}}