by latchkey · 4y ago · 0 comments
// "alt" is now required for improved accessibility
I'm all for accessibility, but let us decide when to implement it.It should be very clear by just looking around on the internet that, when given the choice, accessibility will take a back seat.
That said, the use of empty alt tags is generally discouraged and not even allowed together with the ARIA presentation role in most cases.
This decision of theirs will steer developers towards non-compliant/asemantic code. It's really stupid.
https://html.spec.whatwg.org/multipage/images.html#alt
https://w3c.github.io/aria/#example-13
"In the following code sample, the containing img and is appropriately labeled by the caption paragraph. In this example the img element can be marked as presentation because the role and the text alternatives are provided by the containing element."
<img src="example.png" role="presentation" alt="">
So empty alt tags are not discouraged.
Empty strings are the way to go for decorative images
Which usually means never.
See also (naming things): https://twitter.com/secretGeek/status/7269997868
That's like saying "Typescript just encourages people to make everything `any` instead of defining types. It's a useless addition over JS." Sure, you _could_, but most actually use the actual tool.
It's 6 extra characters, you'll survive.