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

role=img should allow accName other than aria-label or aria-labelledby #1398

Closed
mitchellevan opened this issue Feb 8, 2021 · 4 comments · Fixed by #1496
Closed

role=img should allow accName other than aria-label or aria-labelledby #1398

mitchellevan opened this issue Feb 8, 2021 · 4 comments · Fixed by #1496
Assignees
Labels
has PR PR exists that will close this issue
Milestone

Comments

@mitchellevan
Copy link

Requested change:

I'm requesting role=img be edited to use @mcking65's phrase from pull request #785 comments: authors MUST provide a label, which can be done with the aria-label or aria-labelledby attribute

This was in response to @carmacleod's draft in issue #783 comments: In order for elements with a role of img to be perceivable, authors MUST provide a label determined by the accessible name calculation.

Currently:

The ARIA spec for role=img currently says, "authors MUST provide a label using the aria-label or aria-labelledby attribute."

However, in some cases role=img can get its accessible name from a name from author mechanism, without actually using either aria-label or aria-labelledby. The ARIA spec should not prohibit these cases.

  1. ARIA in HTML allows role=img on an <iframe> element, which can get its accessible name from a title attribute.
  2. role=img is "NOT RECOMMENDED" for an <img> element, but a valid reason may exist to use it, such as @scottaohara's workaround for a Safari bug. In this case the alt attribute of an <img> can still provide its accessible name.
@JAWS-test
Copy link
Contributor

role=img is allowed for other HTML elements that can be labeled with the title attribute. Furthermore, role=img is allowed on SVG graphics that can be labeled with the title element or per text content

@mitchellevan
Copy link
Author

role=img is allowed for other HTML elements that can be labeled with the title attribute.

I agree. This is not a coding best practice, but it should not fail ARIA validation.

Furthermore, role=img is allowed on SVG graphics that can be labeled with the title element or per text content

When you say "labeled with," if you mean...

<svg role="img" aria-labelledby="svg-title">
    <title id="svg-title">HTML5 logo</title>...
</svg>

... then that's a true statement, but not relevant to this issue, because it already passes with or without my proposed edit.

If you mean without aria-labelledby, then that is not a true statement because role=img does not allow name from content (notwithstanding issue #1330).

@JAWS-test
Copy link
Contributor

JAWS-test commented Feb 9, 2021

If you mean without aria-labelledby, then that is not a true statement because role=img does not allow name from content

Yes, I meant that. And the title element is not "name from content", but "name from author". I think that here the AccName specification is unclear if within role=presentation labeling with author elements like label, title, caption etc. should be possible or not

@mitchellevan
Copy link
Author

You're right @JAWS-test, my mistake. A <title> does name <svg role="img">. Thanks for adding these examples, which support the value of my proposed edit.

@jnurthen jnurthen added this to the ARIA 1.3 milestone Feb 11, 2021
scottaohara added a commit that referenced this issue Jun 2, 2021
rewording of how a _name_ (not necessarily a “label” - so changed that word) can be specified for a `role=img`, so as to not imply that a host language naming mechinism would not be allowed. However, I’m wary of explicitly stating a host language naming mechanism could be used here, as I don’t think it’s necessary to do so in this spec.
@scottaohara scottaohara added the has PR PR exists that will close this issue label Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has PR PR exists that will close this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants