Skip to content

limit the allowed roles on img elements - #212

Merged
stevefaulkner merged 2 commits into
gh-pagesfrom
issue_166
Feb 15, 2020
Merged

limit the allowed roles on img elements#212
stevefaulkner merged 2 commits into
gh-pagesfrom
issue_166

Conversation

@scottaohara

@scottaohara scottaohara commented Feb 15, 2020

Copy link
Copy Markdown
Member

closes #166

this PR does the following:

  • limits the allowed roles on an img with alt=some_text.

    • button
    • link
    • menuitem
    • menuitemcheckbox
    • menuitemradio
    • option
    • radio
    • switch
    • tab
  • disallows any role on an img without an alt attribute (some screen readers will ignore an img without an alt. some will announce the file name. rather we not allow a role=button without an accessible name, or with a name "photo-1.jpg").

    If an img is provided an authored defined accessible name via other means (aria-label, aria-labelledby, title) then same allowances as img alt="some text".

I'd be more than open to whittling the allowed roles down further, or hearing reasons to add some back in.


Preview | Diff

closes #166

this PR does the following:

* limits the allowed roles on an `img` with `alt=some_text`.
* limits the disallows roles, or limits the allowed roles on an `img` without an `alt` attribute based on whether it is provided an accessible name via other means.

@stevefaulkner stevefaulkner left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stevefaulkner
stevefaulkner merged commit 67c4b9d into gh-pages Feb 15, 2020
@scottaohara
scottaohara deleted the issue_166 branch February 15, 2020 12:22
@rdeltour

Copy link
Copy Markdown
Member

I believe doc-cover is missing in the list of allowed roles. Also, if link is allowed, then all the DPUB roles extending link should probably be allowed too.

@scottaohara

scottaohara commented Feb 15, 2020

Copy link
Copy Markdown
Member Author

@rdeltour, PRs welcome :)

scottaohara added a commit that referenced this pull request Dec 3, 2021
closes #380.
As noted in #212, `role=radio` was meant to be allowed on an `img alt=foo`.  This corrects the mistake of that allowance not making it into the spec.
scottaohara added a commit to scottaohara/validator that referenced this pull request Dec 3, 2021
related to ARIA in HTML PR w3c/html-aria#212, `role=radio` was meant to be kept as an allowance for an `img` with an accessible name, but it didn't make it into the spec.  

w3c/html-aria#381 will add this allowance
scottaohara added a commit to scottaohara/WAI-ARIA-Usage that referenced this pull request Dec 3, 2021
related to ARIA in HTML PR w3c/html-aria#212, `role=radio` was meant to be kept as an allowance for an `img` with an accessible name, but it didn't make it into the spec.  

w3c/html-aria#381 will add this allowance.  This PR adds this allowance.
scottaohara added a commit that referenced this pull request Dec 13, 2021
* Correction: adds missing radio role allowance for img

closes #380.
As noted in #212, `role=radio` was meant to be allowed on an `img alt=foo`.  This corrects the mistake of that allowance not making it into the spec.

* update changelog
sideshowbarker pushed a commit to validator/validator that referenced this pull request Jan 21, 2022
related to ARIA in HTML PR w3c/html-aria#212, `role=radio` was meant to be kept as an allowance for an `img` with an accessible name, but it didn't make it into the spec.  

w3c/html-aria#381 will add this allowance
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

Successfully merging this pull request may close these issues.

Disallow role of textbox on img elements

3 participants