Search code examples
rhighchartsshinyr-highcharter

Using the accessibility.js module with highcharter


I'm trying to get the accessibility module to work with highcharter, but I can't seem to figure out how to do it.

I'm trying to integrate it into a shiny app, so here's a very minimal example of where I'm at so far:

library(highcharter)
library(shiny)
x <- c("a", "b", "c", "d")
y <- c(1:4)
z <- c(4:7)

data <- data.frame(x,y,z)

ui <- fluidPage(
  fluidRow(
    highchartOutput("chart")
  )
)

server <- function(input, output, session){
  output$chart <- renderHighchart({
hchart(data, "bubble", hcaes(x = x, y = y, size = z))%>%
    hc_add_dependency(name = "modules/accessibility.js")
    })
}

shinyApp(ui = ui, server = server)

But it still is not allowing me to tab through the bubbles.


Solution

  • Edit:

    I can't fix the tab option yet, I will check. sorry.

    Previous answer

    This was a error from highcharter and it was fixed in the development version. Update and test with:

    source("https://install-github.me/jbkunst/highcharter")
    

    Now the accessibility pluging is included by default and you can configure using the hc_accessibility function with options described in the highcharts API documentation.

    I tested using the NVDA.

    highchart() %>% 
      hc_add_series(data = 1:3, type = "column") %>% 
      hc_accessibility(
        enabled = TRUE,
        keyboardNavigation = list(enabled = FALSE)
      )