aboutsummaryrefslogtreecommitdiff
path: root/html_backend.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-01-24 21:30:35 +0700
committerShulhan <ms@kilabit.info>2026-01-24 21:31:17 +0700
commitf289b7f13a1dfc7c096b13b5f194aa61dc14075f (patch)
treef20a6e2b1345b106812ba26010305823a6c2ec30 /html_backend.go
parent170d3e23e2b288c026bc4c8263093bef4138f046 (diff)
downloadasciidoctor-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.go4
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 {