-
Notifications
You must be signed in to change notification settings - Fork 289
Open
Labels
featurea feature request or enhancementa feature request or enhancementreadme 🏠Readme, badges, ...Readme, badges, ...
Description
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).
Bisaloo
Metadata
Metadata
Assignees
Labels
featurea feature request or enhancementa feature request or enhancementreadme 🏠Readme, badges, ...Readme, badges, ...