Hacker News new | ask | show | jobs
by chrismorgan 2102 days ago
I wouldn’t describe role=presentation like that. Rather, it says “ignore what you know about what this element should be, pretend it doesn’t exist and only consider its children”. Technically, that is “replace this node in the accessibility tree with its children”. And then in the case of <img> specifically, it doesn’t have any children, so the effect is removing the entire thing from the accessibility tree, same as an empty alt attribute or aria-hidden=true.

Specifically I’m finding fault with “the screen reader can determine what it wants to do with it”. This isn’t true because the screen reader will never see the image, because the browser removed it from the accessibility tree.

But yeah, https://www.w3.org/TR/wai-aria-practices/#presentation_role lists this as the first of three common uses of role=presentation:

> Hiding a decorative image; it is equivalent to giving the image null alt text.

But still I echo how jscholes ends, and how the WAI-ARIA Authoring Practices document starts: No ARIA is better than Bad ARIA. Be careful what you do if you’re straying from the beaten track, and test things out. In view of this, I will confirm that I have not tested anything that I have said in this comment in order to verify it, though I believe that my mental model of how the accessibility tree and the mentioned details works is accurate.