dashboardr includes built-in
accessibility enhancements targeting WCAG 2.1 AA compliance. These
features are activated with enable_accessibility().
Add enable_accessibility() to include the accessibility
CSS and JavaScript:
page <- create_page("Analysis") %>%
add_viz(
type = "bar",
x_var = "category",
title = "Results",
alt_text = "Bar chart showing category counts"
)enable_accessibility() is called automatically during
page generation.
A “Skip to main content” link appears at the top of the page when a keyboard user presses Tab. This allows users to bypass navigation and jump directly to the dashboard content.
All interactive elements (tabs, inputs, buttons, links) receive visible focus outlines when navigated via keyboard. The default focus style uses a 3px blue outline that meets WCAG contrast requirements.
When a modal dialog is open, Tab and Shift+Tab cycle focus only within the modal’s focusable elements. When the modal closes, focus returns to the element that triggered it.
Filter changes are announced to screen readers via an ARIA live region. When a user changes a filter input, the announcement includes the filter name and selected values.
When the user’s operating system has “reduce motion” enabled
(prefers-reduced-motion: reduce), all CSS transitions and
animations are disabled.
Add descriptive alt text to charts using the alt_text
parameter on any add_viz() call:
page <- create_page("Demographics") %>%
add_viz(
type = "bar",
x_var = "age_group",
title = "Age Distribution",
alt_text = "Bar chart showing the distribution of respondents across age groups, with 25-34 being the largest group"
) %>%
add_viz(
type = "stackedbar",
x_var = "region",
stack_var = "gender",
title = "Gender by Region",
alt_text = "Stacked bar chart comparing gender proportions across four regions"
)Value boxes and metrics support aria_label for screen
reader descriptions:
data <- data.frame(
category = rep(c("A", "B", "C", "D"), each = 25),
region = rep(c("North", "South"), 50),
value = round(rnorm(100, 50, 10))
)
dashboard <- create_dashboard(
title = "Accessible Dashboard",
data = data
) %>%
add_page(
create_page("Overview") %>%
add_value_box(
title = "Records",
value = "100",
aria_label = "Total records: 100"
) %>%
add_viz(
type = "bar",
x_var = "category",
title = "Categories",
alt_text = "Bar chart showing counts for categories A through D"
) %>%
add_viz(
type = "stackedbar",
x_var = "category",
stack_var = "region",
title = "By Region",
alt_text = "Stacked bar chart showing regional breakdown per category"
)
)The accessibility features target WCAG 2.1 Level AA. Key areas covered:
Chart accessibility depends on the rendering backend. Highcharts includes built-in screen reader support and keyboard navigation for chart data points.