diff options
| author | Shulhan <ms@kilabit.info> | 2026-01-24 21:30:35 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2026-01-24 21:31:17 +0700 |
| commit | f289b7f13a1dfc7c096b13b5f194aa61dc14075f (patch) | |
| tree | f20a6e2b1345b106812ba26010305823a6c2ec30 /html_backend.go | |
| parent | 170d3e23e2b288c026bc4c8263093bef4138f046 (diff) | |
| download | asciidoctor-go-f289b7f13a1dfc7c096b13b5f194aa61dc14075f.tar.xz | |
all: add aria-label to the anchor when sectanchor enabled
The aria-label help user with screen reader to discern and navigate
the anchor.
Ref: https://dequeuniversity.com/rules/axe/4.11/link-name
Diffstat (limited to 'html_backend.go')
| -rw-r--r-- | html_backend.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/html_backend.go b/html_backend.go index 14137e5..323b60b 100644 --- a/html_backend.go +++ b/html_backend.go @@ -1167,7 +1167,9 @@ func htmlWriteSection(doc *Document, el *element, out io.Writer) { _, withSectAnchors = doc.Attributes.Entry[docAttrSectAnchors] if withSectAnchors { - fmt.Fprintf(out, `<a class="anchor" href="#%s"></a>`, el.ID) + fmt.Fprintf(out, + `<a class="anchor" href="#%s" aria-label="Anchor for %s"></a>`, + el.ID, el.ID) } _, withSectlinks = doc.Attributes.Entry[docAttrSectLinks] if withSectlinks { |
