נגישות: קישורי Anchor זקוקים לתווית

סיכום מבוסס בינה מלאכותית

In a UX-focused discussion on accessibility, MarcoZehe highlights that anchor links to subheadings in Discourse posts currently lack proper aria-label attributes, causing screen readers to announce unclear or fragmented text—sometimes even post IDs. They recommend adding explicit labels like “Permalink” or “Permalink to [heading text]” to improve clarity for screen reader users. Additionally, MarcoZehe suggests placing the anchor link after the heading text within the h element, rather than before, to avoid repetitive or cumbersome reading when navigating by headings—a common practice for screen reader users. awesomerobot acknowledges the feedback, noting it’s unusual that numbers are being read but agrees the suggestions are sensible and implementable. diondiondion adds context, explaining that without explicit labels, screen readers default to reading the href value, and shares a helpful resource on accessible anchor links: Are Your Anchor Links Accessible?. The thread reflects collaborative, user-driven efforts to enhance Discourse’s accessibility.

Since they just appeared in beta 7, I would like to flag that the links to each sub heading in a long post need an aria-label. The way they are coded, with just the named a tag and probably a background image included via the CSS class .anchor, causes the screen reader to read some number (probably the post ID) and fragments of the heading. Better to be explicit and have something like “Permalink”, or "Permalink to " plus the text of the sub heading. That way, screen reader users opening a list of links on a page, get properly named links.

Also, would it be possible to put the anchor after the heading text inside the h element, not before? Right now, the screen reader, when navigating from heading to heading, will always read the link first, and especially if the heading text is repeated in the label as suggested above, the reading can become quite cumbersome. As screen reader users often get an overview of a page via the heading structure (see various WebAIM screen reader user surveys), it would be better to put the link after the heading text.

Thank you for always improving accessibility in Discourse!

4 לייקים

Hmm, seems strange that a number would be picked up from somewhere…

That aside, these suggestions all make sense and shouldn’t be a problem to implement. Thanks again for the advice!

לייק 1

In the abscence of any other label on a link, screen readers will read the content of the href attribute, so users at least know the link’s destination or URL.

There’s a great technical deep dive on the topic of accessible anchor links here: Are your Anchor Links Accessible? | Amber Wilson

2 לייקים