a11yShiny

EUPL-1.2 R version

Accessible wrappers for popular R Shiny UI components, enforcing ARIA attributes and structural requirements in line with BITV 2.0 and WCAG 2.1 AA.

Installation

Install the package directly from GitLab:

install.packages("devtools")
devtools::install_git("https://gitlab.opencode.de/bmbf/datenlabor/barrierefrei-r.git")

Alternatively, clone the repository and use renv for reproducible dependency management:

# Set your working directory to the package root
setwd("path/to/barrierefrei-r")

renv::init()
renv::install(".")
renv::snapshot()

Getting Started

Load the package and replace standard Shiny UI functions with their accessible counterparts:

library(a11yShiny)

ui <- a11y_fluidPage(
  lang = "de",
  title = "Accessible Demo",
  a11y_fluidRow(
    a11y_column(6, a11y_actionButton("go", label = "Go!")),
    a11y_column(6, a11y_selectInput("sel", label = "Choose", choices = 1:3))
  )
)

For accessible DataTables and basic line/bar charts:

output$tbl <- a11y_renderDataTable({ head(iris, 10) }, lang = "de")

output$plt <- renderPlotly({
  p <- a11y_ggplot2_line(data = iris, x = ~Species, y = ~Sepal.Length)
  plotly::ggplotly(p)
})

A full demo app is included in the package:

shiny::runApp(system.file("examples", "demo", "app.R", package = "a11yShiny"))

For detailed documentation on each function, see the package reference (?a11y_fluidPage, ?a11y_actionButton, etc.) and the examples in inst/examples/.

Core Functions & Accessibility Features

Layout & Structure

a11y_fluidPage, a11y_fluidRow, a11y_column:

Wrappers for fluidPage(), fluidRow() and column().


Inputs

a11y_actionButton

Wrapper for actionButton().

a11y_selectInput(), a11y_numericInput(), a11y_textInput, a11y_dateInput, a11y_radioButtons

Wrapper for selectInput(), numericInput(), textInput(), dateInput() and radioButtons().

a11y_textButtonGroup()

Composite wrapper combining a labeled text input and an action button (e. g. for a search bar with button).

a11y_textInputsGroup()

Wrapper for a group of related textInput elements inside a <fieldset> with <legend> (e.g. address fields, date components, grouped inputs).


Tables

a11y_renderDataTable()

Wrapper for renderDataTable().

div(class = "a11y-dt", DT::dataTableOutput("mytable"))

Charts

A generic wrapper for ggplot2/ggplotly charts is not recommended due to low flexibility and high risk of errors. Several approaches for accessible diagram wrappers were evaluated, but due to limitations, only the first option was implemented in this package as a minimal example:

  1. Minimal ggplot2 Wrapper per Chart Type which can be manipulated afterwards (see a11y_ggplot2_bar/line). Limitation: Must be created for every chart type; user modifications after the wrapper can impair accessibility.
  2. Full Chart Wrapper with Internal ggplotly Conversion which create a complete interactive chart. Limitation: Most accessible, but least flexible – only practical for fixed chart formats.
  3. Generic ggplotly Wrapper which patches accessibility features into a ggplot2 object after creation. Limitation: Messy and error-prone; post-hoc changes often fail as ggplotly may not reliably map all properties.
  4. A wrapper for plotlyOutput which adds landmarks and ARIA attributes (aria-describedby). Limitation: plotlyOutput first renders a simple DIV placeholder in the UI, but after rendering the JavaScript/widget binding replaces or overwrites some attributes and may reset or remove classes/IDs/ARIA attributes; the attribute is not always guaranteed to be visible in the finished DOM tree. It must be set individually by the user.

Support for pattern fills, certain ARIA attributes, or colorblind-friendly mapping is always limited by ggplot2/plotly’s underlying capabilities and design. Instead users should follow accessibility guidelines for charts. Best practice: Users should

a11y_ggplot2_line() / a11y_ggplot2_bar()

Minimal wrapper for ggplot2() for a multi-line and simple bar chart.


High-contrast mode

Wrapper for a global high-contrast mode toggle button.


Utility Functions

Known Limitations

Limitations are mainly library-dependent. Some specific capabilities (modal copy dialogs, responsive DT layouts, numeric DT filters, chart tooltips) cannot yet be made fully accessible through wrappers alone. Always test your outputs with accessibility auditing tools (see below).

Getting Help

Contributing

Contributions to a11yShiny are welcome. Please open an issue or submit a merge request on the GitLab repository.

License

a11yShiny is licensed under the European Union Public Licence (EUPL) v1.2.

R Version Support

a11yShiny requires R >= 4.1.

mirror server hosted at Truenetwork, Russian Federation.