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

Make the badges accessible to screenreader #117

Closed
jennybc opened this issue Dec 18, 2021 · 8 comments · Fixed by #130
Closed

Make the badges accessible to screenreader #117

jennybc opened this issue Dec 18, 2021 · 8 comments · Fixed by #130
Assignees

Comments

@jennybc
Copy link
Member

jennybc commented Dec 18, 2021

It would be nice if the lifecycle badge SVGs included the stage in aria-label or similar.

As the maintainer of usethis and, therefore, the one-who-adds-lots-of-badges, I'm making similar requests in various places.

Gabor already did it (a while ago) in the badges provided by METACRAN:
metacran/metacranweb@8287a21

shields.io badges already are accessible FWIW.

I'm not sure how the .svgs here are actually made but presumably it's not too hard to do this.

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"

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"

show_aria_label("https://raw.githubusercontent.com/r-lib/lifecycle/main/man/figures/lifecycle-experimental.svg")
#> NULL

Created on 2021-12-17 by the reprex package (v2.0.1.9000)

@hadley
Copy link
Member

hadley commented Aug 13, 2022

@batpigandme is this something you'd be interested in doing?

@batpigandme batpigandme self-assigned this Aug 14, 2022
@batpigandme
Copy link
Contributor

@hadley sure thing

@batpigandme
Copy link
Contributor

Question/point of clarification:

@jennybc, the way that the lifecycle badges are generated in usethis (badge.R#L93-L113), they do have aria-labels, right? From https://github.com/r-lib/usethis/blob/b0318bf7cadd25797ae97301893923933207c5ca/R/badge.R#L101

  src <- glue("https://img.shields.io/badge/lifecycle-{stage}-{colour}.svg")

you'd get, e.g.https://img.shields.io/badge/lifecycle-stable-brightgreen.svg for stable.

library(tidyverse)

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

show_aria_label("https://img.shields.io/badge/lifecycle-stable-brightgreen.svg")
#> [1] "lifecycle: stable"

Created on 2022-08-14 by the reprex package (v2.0.1)

batpigandme added a commit to batpigandme/lifecycle that referenced this issue Aug 15, 2022
@jennybc
Copy link
Member Author

jennybc commented Aug 15, 2022

Yes shields.io badges do have aria labels. This issue is about the properties of static svgs we provide.

@batpigandme
Copy link
Contributor

10-4. I replaced the ones in the lifecycle package itself (https://github.com/batpigandme/lifecycle/tree/aria-labels), but I've not been able to suss out where they're actually built in the lifecycle (I messaged lionel for clarification). So, it's a WIP right now.

@hadley
Copy link
Member

hadley commented Aug 15, 2022

I think each package will need to re-run use_lifecycle() in order to update their copy of the lifecycle badges.

@batpigandme
Copy link
Contributor

Yeah, that's what it looked like to me—that the badges themselves aren't actually constructed in lifecycle locally. Do you still want the PR to fix the aria-labels for the badges for lifecycle?

@jennybc
Copy link
Member Author

jennybc commented Aug 16, 2022

I think each package will need to re-run use_lifecycle() in order to update their copy of the lifecycle badges.

This seems like a good candidate for upkeep checklist item.

batpigandme added a commit to batpigandme/lifecycle that referenced this issue Aug 16, 2022
jennybc added a commit to r-lib/usethis that referenced this issue Aug 16, 2022
@hadley hadley closed this as completed in 087c6ce Aug 16, 2022
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jun 17, 2023
# usethis 2.2.0

## New functions

* `use_author()` is a new function to introduce a new person into the
  `Authors@R` field of DESCRIPTION (@avalcarcel9, #833).

* `use_rstudio_preferences()` lets you set RStudio preferences programmatically
  (#1518)

* `use_standalone()` is a new function that makes it easier to use standalone
  files provided by various low-level tidyverse packages, like rlang (#1654).

* `use_upkeep_issue()` is a new function to facilitate regular maintenance of
  your package. Similar to `use_release_issue()`, it opens an issue in your repo
  with a checklist of maintenance tasks. It will include additional bullets
  if your package includes an `upkeep_bullets()` function that returns a
  character vector (#1794).

## Package development

* Although nested projects are discouraged, they can be useful in development
  contexts. `create_package()` now sets the correct package name and returns
  the correct package path for a package nested inside a project (#1647).

* `use_article()` no longer adds the rmarkdown package to `Suggests`. Instead,
  if rmarkdown is not already a dependency, it's added to
  `Config/Needs/website`. This means that a package that only uses articles
  (vs. vignettes) won't gain an unnecessary dependency on rmarkdown (#1700).

* `use_data()` now sets the appropriate minimal R version in `DESCRIPTION`,
  depending on which serialization format `version` you choose (@dpprdan, #1672).

* `use_github_links()` by default now appends the GitHub url to existing urls in
  in the `URL` field of DESCRIPTION, rather than replacing existing urls (#1805).

* `use_latest_dependencies()` no longer affects `Suggests` since those
  dependencies are not enforced (#1749).

* `use_news_md()` now places "(development version)" in the header of `NEWS.md`
   if there is a development version number in `DESCRIPTION`. It also sets the
   first bullet to "Initial CRAN submission" when it looks like a "new" package
   (#1708).

* `use_coverage()` no longer adds covr to `Suggests`, since the `test-coverage`
  GitHub Actions workflow takes care of installing covr (@Bisaloo, #1851).

## Package release

* `use_release_issue()` will now remind you to run `use_github_links()` if
  necessary (@Bisaloo, #1754)

* `use_release_issue()` now encourages the creation of `NEWS.md` prior to
  submission, instead of after (#1755).

* `use_github_release()` now automatically pushes to GitHub (if safe) and
  automatically publishes the release, rather than requiring you to edit and
  publish the draft (#1385).

* `use_github_release()` no longer fails in the absence of `NEWS.md` (#1755).

* `use_release_issue()` will now remind you to check/close the milestone
  corresponding to the release, if it exists (#1642).

* `use_version()` and `use_dev_version()` gain a `push` argument to optionally
  push the result after committing. This is used to eliminate a manual step from
  the `use_release_issue()` checklist (#1385).

* `use_revdep()` no longer places an email template, because these days we are
  more likely to communicate with other maintainers about breaking changes via
  GitHub issues and pull requests (#1769).

## Package file management

* `rename_files()` now also affects files in `src/` (#1585).

* `use_r()` and `use_test()` now work with all active files in `R/`, `src/`,
  and `tests/testthat/` (#1566).

* `use_r()` and `use_test()` now work with files containing `.` (#1690).

* `use_rcpp()`, `use_c()` and friends now work the same way as `use_r()` and
  `use_test()`: they'll take the default file name from the file you currently
  have open in RStudio (#1730).

## Git and GitHub

* `create_from_github()` will now use an existing `.Rproj` file if it exists
  anywhere in the repo, not just the root directory. This is useful if you're
  working with repos that contain tools for multiple languages (#1680).

* `git_sitrep()` gains two arguments: `tool` and `scope`, which enables
  you to limit the report to, for example, `tool = "git"` or `scope = "user"`.
  The default remains to provide a full report. Also, provides more
  feedback if git user's information is not set, and checks global git-email
  against user-level GitHub PAT (@ijlyttle, #1732, #1714, #1706).

* `git_vaccinated()` now treats a path configured as `core.excludesFile` like
  other user-supplied paths; in particular, any use of the `~/` home directory
  shortcut is expanded via
  [`fs::path_expand()`](https://fs.r-lib.org/reference/path_expand.html)
  (@dpprdan, #1560).

* `use_github_action()` now suggests possible actions when called without
  arguments (#1724).

* `use_github_actions()`, `use_github_action_check_standard()`,
  `use_github_action_check_release()`, and `use_github_action_pr_commands()`
  have been deprecated in favour of the new interactive powers of
  `use_github_action()` (#1724).

## Minor improvements and fixes

* Links to the R Packages book have been updated to the second edition of
  the book (#1689).

* The SVG badges placed by `use_lifecycle()` have improved accessibility
  features, i.e. they advertise the lifecycle stage via the `aria-label`
  attribute (#1554, r-lib/lifecycle#117).

* `use_rscloud_badge()` has been deprecated in favour of
  `use_posit_cloud_badge()`, and both functions now accept the updated url
  format of Posit Cloud projects (#1670).

* `use_rstudio()` gains a `reformat` argument which omits `.Rproj` settings
  that enforce file formatting conventions, e.g. around whitespace.
  `create_from_github()` uses this option when it introduces an `.Rproj` to a
  project that lacks one, making it easier to follow the project's existing
  conventions (#1679).

* `write_over()` and `use_github_file()` gain an overwrite argument (#1748).

## Tidyverse-related

* `use_release_issue()` now uses internal `release_extra_revdeps()` to
  add extra revdep sources. Currently only use for internal Posit tooling,
  but we hope to extend to all users in the future (#1610).

* `use_tidy_logo()` is a new function that calls `use_logo()` on the appropriate
  hex sticker PNG file at <https://github.com/rstudio/hex-stickers> (#1871).

## Defunct functions

* `use_tidy_eval()` is now defunct because it imports and re-exports a large
  number of functions that are no longer needed in order to do tidy
  evaluation (#1656).

* `use_travis()`, `use_pkgdown_travis()`, `browse_travis()`, and `use_appveyor()`
  are now defunct because we no longer recommend Travis or Appveyor. We
  recommend GitHub actions instead (#1517).
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 a pull request may close this issue.

3 participants