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

More accessible badges #1554

Open
jennybc opened this issue Dec 18, 2021 · 2 comments
Open

More accessible badges #1554

jennybc opened this issue Dec 18, 2021 · 2 comments
Labels
feature a feature request or enhancement readme 🏠 Readme, badges, ...

Comments

@jennybc
Copy link
Member

jennybc commented Dec 18, 2021

Since usethis is the package that adds a lot of badges to READMEs, maintainers have asked us to help make those badges more accessible to screen readers.

I suspect the best way to do this is via the badge SVGs themselves.

@gaborcsardi already added this to METACRAN's badges:

library(tidyverse)

show_aria_label <- function(badge) {
  badge %>%
    xml2::read_xml() %>%
    xml2::as_list() %>%
    pluck("svg") %>%
    attributes() %>%
    pluck("aria-label")
}

show_aria_label("https://www.r-pkg.org/badges/version/usethis")
#> [1] "CRAN 2.1.5"

show_aria_label("https://www.r-pkg.org/badges/last-release/usethis")
#> [1] "CRAN 2021-12-09"

show_aria_label("https://cranlogs.r-pkg.org/badges/usethis")
#> [1] "CRAN downloads 270K/month"

Any badge produced via https://shields.io/ is already accessible:

show_aria_label("https://img.shields.io/github/workflow/status/r-lib/usethis/R-CMD-check?label=R-CMD-check")
#> [1] "R-CMD-check: passing"

show_aria_label("https://img.shields.io/badge/my__label-my__message-orange")
#> [1] "my_label: my_message"

The features of https://shields.io/ badges mean we can often substitute an accessible badge, even if the "native" badge is not (e.g. for GitHub or Codecov). I am about to explore that idea further in a pull request.

I've already placed requests with the lifecycle package (r-lib/lifecycle#117) and with GitHub Actions (community post, post in Actions and Packages Feedback).

@jennybc
Copy link
Member Author

jennybc commented Dec 18, 2021

I'm going to try to do something about these:

  • use_bioc_badge() I've reached out to Bioconductor and it looks like they can address it early in the new year.
  • use_cran_badge() already handled via METACRAN
  • use_github_actions_badge() request made; will use shields.io in a PR
  • use_lifecycle_badge() usethis already writes a shields.io badge; request made for the lifecycle package to update its svgs
  • usethis:::use_codecov_badge() will use shields.io in a PR

I'm not tackling these:

  • use_appveyor_badge()
  • use_circleci_badge()
  • use_travis_badge()
  • use_binder_badge()

@jennybc
Copy link
Member Author

jennybc commented Dec 22, 2021

This new article contains my analysis of where things stand:

https://usethis.r-lib.org/dev/articles/badge-accessibility.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement readme 🏠 Readme, badges, ...
Projects
None yet
Development

No branches or pull requests

2 participants