a11yproject / a11yproject.com

The A11Y Project is a community-driven effort to make digital accessibility easier.
https://a11yproject.com
Apache License 2.0
3.7k stars 551 forks source link

Inaccuracy: VoiceOver on Mac understanding svgs with role=img #1562

Closed FayeDM closed 1 year ago

FayeDM commented 1 year ago

This is present in the current checklists.json around line 179:

"title": "Ensure that <code>img</code> elements with an <code>svg</code> source includes the <code>role=\"img\"</code> attribute.",
                "checkboxId": "svg-image-src",
                "wcag": "4.1.2 Name, Role, Value",
                "url": "https://www.w3.org/TR/UNDERSTANDING-WCAG20/ensure-compat-rsv.html",
                "description": "VoiceOver on macOS and iOS will not correctly convey the element as an image if <code>role=\"img\"</code> is not present."

I regularly test with VoiceOver on macOS and this is not accurate to my experience. I retested today after seeing this and found that VoiceOver does interpret an image with an svg source as an image.

In this screencapture you can see in the bottom left what VoiceOver is reading for this <img> with an svg source. It reads: "An infograph of Kanopi's 3 part CWI process of strategize, implement, learn & iterate., image". You can view this example live at kanopi.com.

In addition, when using SiteImprove platform and extension, it may flag role="img" on an image element as an error due to redundancy.

I could not find any supporting content for or against this recommendation, but I figured I would post my experience anyway and let ya'll decide if it's time for an update.

Screencapture of VoiceOver reading an image element by its alt text and then element type.
scottaohara commented 1 year ago

at the time this was written, this was not inaccurate. Prior to september 2021 this was a common issue where images with svg sources were treated as "groups" - where this behavior had been around since at least mid-2018.

This was fixed in Safari 14.1.2 on macOS 11.5.2, and iOS 14.7.1. So, likely "safe" to remove this, or (better yet) specifically call out that if your support matrix requires you account for these platforms, then this would still be necessary to expose such images as the web author likely intends for them to be.

edited to better align with eric's comment, as i tend to agree with him more here than my comment may have indicated.

ericwbailey commented 1 year ago

I'd advocate for keeping it in. Regressions on VoiceOver are frustratingly commonplace, Safari is not an evergreen browser, and Apple hardware is expensive. These all conspire to set up a situation where it might easily still be applicable, and the declaration doesn't hurt things in its current form.

FayeDM commented 1 year ago

What about keeping the item but updating the verbiage?

"It's recommended that img elements..."

and

"VoiceOver on macOS and iOS may not correctly..."

scottaohara commented 1 year ago

PRs are welcome :)