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

Review decorateIcons accessibility #18

Open
kptdobe opened this issue Sep 27, 2023 · 1 comment
Open

Review decorateIcons accessibility #18

kptdobe opened this issue Sep 27, 2023 · 1 comment

Comments

@kptdobe
Copy link
Contributor

kptdobe commented Sep 27, 2023

#13 and #14 reveals some accessibility issues with the old implementation of the decorateIcons. While new implementation does not make the use of svg element, it now uses an img element but does not add a alt nor a title to the image which is an accessibility issue.

We need to review and fix the decorateIcons accessibility issues including:

When icons were svgs, the title and description were extracted from the icon svg. Now that icons are images, this is not possible.
Note that adding an alt text is not always necessary (see https://dequeuniversity.com/rules/axe/4.7/image-redundant-alt) and that the problem is not fully trivial: adding alt text based on the image name can be useless (like icon arrow-up does not really help - while I agree it is better than nothing) and since icons are referenced like :arrow-up: in the content, they cannot be annotated.

@ramboz
Copy link
Collaborator

ramboz commented Oct 25, 2023

I'd say we will be in one of 2 possible cases with icons:

  1. they are purely used for decoration purposes and do not convey any relevant information. In that case an alt=" " and/or role="presentation" would be enough
  2. the icon is used to convey relevant information or context, and in that case we need to explicitly populate an alt or aria-label

I'd propose updating the decorateIcon (singular) to take a new optional parameter: decorateIcon(span, prefix = '', alt = ' '). By default, all icons would be purely decorative (most cases), but projects could opt-in to individually override icons they know should be descriptive either in their blocks or in the auto-blocking function. This also leaves the details of hyperlinked icons to the project (i.e. either auto-name based on icon name, or use an explicit label approach)

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