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

Improve accessibility of badges #589

Closed
wants to merge 1 commit into from
Closed

Conversation

17cupsofcoffee
Copy link
Collaborator

It occurred to me while reviewing #587 that if you're using a screen reader, you don't get any of the information provided by the badges. This doesn't seem ideal, given that information is what you're likely to use to decide which crate is more actively updated!

This PR replaces the alt text for the badges with equivalent information sourced from the APIs, and removes the aria-hidden attribute so that screen readers won't ignore them.

This could also help with #580, as we now have the information we'd need to sort by.

I haven't added this functionality to the license badge (yet), as the Crates.io API doesn't make that super easy to obtain (you have to fetch all the crate versions, then pick the license from the one matching latest_version). I can think of three approachs to sort this:

  • Just accept the larger Crates.io load (not ideal, don't want to get rate limited and/or make the Crates.io team mad at us).
  • Grab the license from the GitHub API instead (this would also open up being able to have last commit date/star count for crates sourced items, but again, it might get us rate limited).
  • Change the link URL to point directly at the license somehow (bit of a cop out, but at least it would make it easier to find).

@17cupsofcoffee
Copy link
Collaborator Author

One potential downside to this approach: the alt text might not always be in sync with the badges, as the former would only update whenever the site is rebuilt (currently once a week, plus when PRs are merged), whereas the latter gets updated on every page load.

I don't think this is the end of the world, but it does make me wonder if we might be better off just displaying the local data rather than relying on shields.io.

@17cupsofcoffee
Copy link
Collaborator Author

I am going to close this and open a new PR, as fixing the issues mentioned has made the scope increase quite a bit 😄

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.

1 participant