Search code examples
rr-markdownslickr

adding alt text tags to slickR carousel in R


Colleagues and I are building a website in R-Markdown (basic, not blogdown, distillR, etc.) and have a couple slide carousels created using the slickR package. The code looks like:

library(slickR)

images <- c("Slide1.JPG", "Slide2.JPG", "Slide3.JPG", "Slide4.JPG", "Slide5.JPG")
test <- slickR(obj = images, height=350, width='100%') 
test

I have Googled around and cannot find a way to add alt text tags so that as you swipe from side to side you get text a screen reader can read. Is this possible? If so how? Or, are there other ways to make the carousel accessible?

Thanks!


Solution

  • Following vignette for slickR with DOMS

    library(slickR)
    
    images <- c("Slide1.JPG", "Slide2.JPG", "Slide3.JPG", "Slide4.JPG", "Slide5.JPG")
    imgs_bare <- mapply(function(x,txt){
      htmltools::tags$img(src = x, title = txt)
    },x = nba_player_logo$uri[c(1:5)],txt = images,SIMPLIFY = FALSE)
    slickR(obj = imgs_bare, height=350)