An in-development R package to assess the alternative (alt) text from a web page.

Description

Scrape image element attributes from a webpage, detect alternative (alt) text and assess it with simple heuristics. Alt text is important for users of assistive technologies, like screen readers, for understanding the content of images. This package should be used in conjunction with other accessibility assessment tools for more comprehensive coverage.

Read more about this package in the accompanying blog post.

Use

Install from GitHub using the {remotes} package:

install.packages("remotes")
remotes::install_github("matt-dray/altcheckr")
library(altcheckr)

There are two major functions for now:

  • alt_get() creates a tibble of HTML attributes for each ‘img’ element on a supplied web page
  • alt_check() performs basic checks of the alt text for each image

See the ‘introduction to {altcheckr} functions’ vignette for more information: run vignette("introduction", altcheckr) or visit the {altcheckr} website.

Right now, the alt_check() function flags when alt text:

  • is missing (but this is okay if the image is decorative)
  • is noticeably short or long (length can be controlled by the user)
  • contains self-evident phrases (‘image of’, ‘picture of’, etc)
  • is missing terminal punctuation, which interferes with how the sentence is parsed

And it also:

  • highlights words that may be misspelled, via the {hunspell} package
  • returns a list of words that don’t appear to be basic English

Code of conduct

Please note that the ‘altcheckr’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.