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

Replace Shields.io with locally rendered data/badges #591

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

17cupsofcoffee
Copy link
Collaborator

@17cupsofcoffee 17cupsofcoffee commented Jan 13, 2025

Currently, data like download counts and licenses is displayed by embedding Shields.io badges as image tags. This PR (which is an extension of #589) replaces these entirely with data fetched directly from Crates.io/GitHub/GitLab.

There's two pretty big benefits to doing this:

  • It makes the data more accessible to people who are using screen readers (we have no way of providing any meaningful alt text for the existing badges, as Shields.io doesn't provide any way of accessing the underlying data).
  • It unlocks the possibillity of adding (client-side) sorting functionality later down the line.

However, there are also some tradeoffs:

  • The data will no longer be 100% up to date, as it'll only get fetched when the site re-renders.
    • This is done once a week, as well as when PRs are merged, though - so it should never get too stale.
  • The site now takes a bit longer to build (1 minute on CI, as opposed to 30 seconds).
  • Due to the extra requests to GitHub, we now have to provide a token to avoid getting rate-limited.
    • In fairness, this would have started happening as soon as we had more than 60 items with source = "github" anyway - the unauthenticated rate limit is very low!
    • GitHub Actions provides a token for every CI build anyway, but you'd have to provide one yourself if you're building locally.

I personally think these trade-offs are worth it (assuming I can get around to implementing the sorting functionality later!), but I'd be interested to get some feedback from the community on whether they think this is the right direction.

Here's what the new UI looks like (see the live page for comparison):

image

(the top three items there use the crates source, the last one uses the github source)

@ZimboPro
Copy link
Contributor

What you could is keep the shields.io badges and just use the API calls to Github, Gitlab etc to power the alt data. This will allow that visually, it will be still up-to-date. The screen readers will be out of sync but just making a note somewhere on the page should help inform the users.

@17cupsofcoffee
Copy link
Collaborator Author

17cupsofcoffee commented Jan 14, 2025

What you could is keep the shields.io badges and just use the API calls to Github, Gitlab etc to power the alt data. This will allow that visually, it will be still up-to-date. The screen readers will be out of sync but just making a note somewhere on the page should help inform the users.

That's what I was originally intending to do - I feel like that approach could make things confusing when I come to add the sorting functionality, though (as that would have to be driven by the local data). I'll give it some thought.

I tried the page with NVDA, and the aria-label approach didn't work (apparently it's not valid for 'li' tags). So instead, I just tweaked the markup to properly present the item's title first.
@17cupsofcoffee 17cupsofcoffee marked this pull request as ready for review January 16, 2025 17:38
A lot of the cases where 'Other' was showing as the license turned out to be MIT/Apache projects with their files named wrong, which feels misleading.
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.

2 participants