Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propose conformance addition for decorative img elements #452

Open
MelSumner opened this issue Mar 15, 2023 · 1 comment
Open

Propose conformance addition for decorative img elements #452

MelSumner opened this issue Mar 15, 2023 · 1 comment

Comments

@MelSumner
Copy link

MelSumner commented Mar 15, 2023

Right now, this is the way that an author crafts a conformant image element that is purely presentational:

<img src="photo.webp" alt="" />

I don't want to change this, but I want to propose that we add an additional invocation that does not fail conformance checkers:

<img src="photo.webp" alt="" role="none" />
<img src="photo.webp" alt="" role="presentational" />

Why

With the advancements in IDEs, many elements have TAB completion. So I can type img in my file, and press TAB, and end up with <img src="" alt="" />

This is very convenient! But what it does is take away what was previously the sole indicator of author intent- the presence of an alt attribute and whether there was a value or not. With the alt attribute being added automatically, it is still very easy for an author to ignore putting a value in the code for the attribute.

The way I have done this in some code checkers is to check for the combination of an empty alt attribute and the role="none" (or presentation). If only the alt attribute is there, I throw an error, which is used to get the developers attention.

However, this approach fails current validation checkers.

Proposal

As such, I propose that we should allow three ways to indicate that an image is purely decorative:

<img src="photo.webp" alt="" />
<img src="photo.webp" alt="" role="none" />
<img src="photo.webp" alt="" role="presentational" />

This would support the lovely advancements in convenience that IDEs have made while also still providing a good way for validators to ensure intent.

@scottaohara scottaohara transferred this issue from w3c/aria Mar 16, 2023
@scottaohara
Copy link
Member

This issue didn't belong in ARIA.

This would be related to #424

scottaohara added a commit that referenced this issue Mar 16, 2023
This PR closes #424 and #452

Description of changes to come....
scottaohara added a commit that referenced this issue Oct 3, 2023
Clarify and consolidate img ARIA allowances

This PR closes #424 and #452

* clarify when img role is allowed
* add meter to allowed role for img
* similar to progressbar, meter should thus also be allowed.
* fix img lacking alt allowance
* update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants