martymcguire / indiewebring.ws

Code for the glitch.com-powered site at πŸ•ΈπŸ’.ws
34 stars 1 forks source link

Improve accessibility of the output code for the webring #16

Open ohhelloana opened 2 years ago

ohhelloana commented 2 years ago

Hello! I think there's room to improve the accessibility of the output code as the arrows don't read well on screen readers (or as a standalone link).

On my own website I added some aria-labels to describe the arrows. Here's an example:

<a href="https://xn--sr8hvo.ws/previous" aria-label="Previous website in the IndieWeb webring">←</a> An IndieWeb Webring πŸ•ΈπŸ’ <a href="https://xn--sr8hvo.ws//next" aria-label="Next website in the IndieWeb webring">

Since my website already has lang=en set it doesn't matter, but this might not be be case for people copy/pasting this code who may have a website in any other language. So I also think there should be some sort of lang=en wrapping up the output.

I also like Calum's approach on his website.

Opening up the issue as I'm sure there could be great suggestions of how to keep the code simple as well.

martymcguire commented 2 years ago

Thanks for kicking this off @ohhelloana !

I've been idly thinking about this for the past week and I am currently leaning towards using your proposal and wrapping it in a <div> something like this:

<div lang="en">
<a href="https://xn--sr8hvo.ws/previous" aria-label="Previous website in the IndieWeb webring">←</a> An IndieWeb Webring πŸ•ΈπŸ’ <a href="https://xn--sr8hvo.ws//next" aria-label="Next website in the IndieWeb webring">
</div>

While it seems that aria-label is still not translated by most translation software, the lang + aria-label hints should at least give screen reader users a clear reading of the English-only labels on the links.

In the interests of translate-ability, I'd prefer to do some kind of visually-hidden class for screenreaders only, but I think it's too far to include a CSS declaration for one, and feels difficult to document concisely.

Maybe it would be possible to start with the above as a default, then enhance it by offering an "advanced" widget to let you enter your own label texts and language indicator. An even more advanced step could be indicating whether your site already has a visually-hidden or sr-only class and applying that.

In general I love to try and "under-engineer" things so that they are concise and each piece makes sense to someone looking at it who might not have a deep understanding of HTML. However, accessibility takes priority over that!

Looking forward to others' thoughts!

ohhelloana commented 2 years ago

I do like the idea of an advanced/customisable output (for the future).