Skip to content

Update accName calculation (fallback to title when alt="") #4971

@WilcoFiers

Description

@WilcoFiers

The following should pass:

<button>
  <img src="#" alt="" title="hello world">
</button>

I came across an image like this (although without the button) today. Testing this in Chrome, Safari and Firefox this seems to work. I recall the spec about how empty props are handled changing a while ago. It is possible that a similar thing now works for aria-label="" as well, as part of this we should test that too. I haven't confirmed this in actual AT so we'll want to do some screen reader testing to make sure as well. Just because devtools says something has a label doesn't mean screen readers will accept that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixBug fixesstandardsIssues in the ARIA standards objects (lib/standards)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions