w3c / html-aria

ARIA in HTML
https://w3c.github.io/html-aria/
Other
181 stars 48 forks source link

update allowances for image with empty alt #243

Closed scottaohara closed 3 years ago

scottaohara commented 3 years ago

commit to remove allowance for role=presentation and role=none on an <img src=... alt="">. Declaring these roles should be considered redundant/unnecessary per the alt="".

If there are situations where an image with alt="" is not being set to decorative, (thinking an img with a .svg source in webkit) then authors can still use aria-hidden=true to force the element to be hidden to the a11y tree (and would have needed to use that anyway).

closes #229


Preview | Diff

carmacleod commented 3 years ago

Question: Did you want to allow <img src="url" role="presentation"> for "img without alt attribute"? (i.e. the example given in #229)

If so, might want to change the first sentence under "img without alt attribute" from:

If no author-defined accessible name is provided by other methods: No role, and no aria-* attributes except aria-hidden.

to something like:

If no author-defined accessible name is provided by other methods: Roles: none or presentation. No aria-* attributes except aria-hidden.

scottaohara commented 3 years ago

@carmacleod no. Then that could result in instances of the file name of the image being announced without the image role.

If an author can add role=presentation to their <img> then it stands to reason they can add the shorter alt="" attribute and meet HTML's requirements to add an alt.