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

alt tag content missing from contributor template #310

Open
juliaferraioli opened this issue Jun 5, 2022 · 3 comments
Open

alt tag content missing from contributor template #310

juliaferraioli opened this issue Jun 5, 2022 · 3 comments

Comments

@juliaferraioli
Copy link

  • all-contributors-cli version: v6.20.0
  • node version: v12.22.12
  • npm (or yarn) version: 8.3.0

Relevant code or config

format-contributor.js

'<img src="<%= contributor.avatar_url %>?s=<%= options.imageSize %>" width="<%= options.imageSize %>px;" alt=""/>'

Problem description:

The image for a contributor has an empty alt text attribute, which looks like it was added in #138 and removed in #218. While best practices for alt-text is to not include it for decorative images, which was the justification for removing it, I contend that profile pictures are not decoration. Profile pictures are part of the contributor's identity -- if they weren't, then there would be no reason for including them in the first place. In my opinion, they fall under the informative images classification under the WC3's WAI. More detail can be found in the WCAG standard itself.

I'd also reference the decision tree, which doesn't lend itself to the conclusion that the profile picture is decorative.

Suggested solution:

That being said, the original implementation didn't add much value beyond the name of the profile user. We have the information, so a more comprehensive alt text string can be composed.

I'm currently using alt=\"<%= contributor.name %>'s GitHub profile picture\"/> in my template, but other options exist, such as:

  • Profile picture of {name}, whose bio is {bio}
  • Profile picture of {name}, who has {contribution stats} (using the contextual user API)

or pick your preference.

There is a case to be made that since these images are actually links, then they should adhere to the functional images classification, in which case the alt text should indicate where it is linking. That might look like "Profile picture of contributor linking to {link}", but it also might be better then to only link to their html_url and then be able to standardize on "Picture of contributor linking to their GitHub profile".

Thoughts?

@Berkmann18
Copy link
Member

You're right that an empty alt seem futile, and I like the first option you provided.
@all-contributors/core What do you think?

@tenshiAMD
Copy link
Member

You're right that an empty alt seem futile, and I like the first option you provided. @all-contributors/core What do you think?

@all-contributors/core I think we can do a fallback value for the alt (maybe the first option or just the name). I'm also thinking to add configuration options for the alt (maybe like contributorsImageAlt) then we provide some dynamic template options like username, bio, etc.

@Berkmann18
Copy link
Member

That's a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants