Skip to content

Commit

Permalink
accessibility radio button and action link update
Browse files Browse the repository at this point in the history
  • Loading branch information
kygoffe committed Nov 13, 2023
1 parent c9ea0ba commit 9a142d2
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 4 deletions.
55 changes: 55 additions & 0 deletions R/utils_accessibility.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,58 @@ nhs_card_tabstop <- function(header, tabindex = 0, ...) {
nhs_card_tabstop <- div(nhs_card(header, ...)) %>%
htmltools::tagAppendAttributes(`tabindex` = tabindex)
}







#' accessible_radio_button
#'
#' @param ... radio content
#'
#' @noRd
#'
accessible_radio_button <- function(inputId, label, choices = NULL, selected = NULL,

Check warning on line 140 in R/utils_accessibility.R

View workflow job for this annotation

GitHub Actions / lint

file=R/utils_accessibility.R,line=140,col=37,[object_name_linter] Variable and function name style should match snake_case or symbols.
inline = FALSE, width = NULL, choiceNames = NULL,

Check warning on line 141 in R/utils_accessibility.R

View workflow job for this annotation

GitHub Actions / lint

file=R/utils_accessibility.R,line=141,col=67,[object_name_linter] Variable and function name style should match snake_case or symbols.
choiceValues = NULL) {

Check warning on line 142 in R/utils_accessibility.R

View workflow job for this annotation

GitHub Actions / lint

file=R/utils_accessibility.R,line=142,col=37,[object_name_linter] Variable and function name style should match snake_case or symbols.
args <- shiny:::normalizeChoicesArgs(choices, choiceNames, choiceValues)

Check warning on line 144 in R/utils_accessibility.R

View workflow job for this annotation

GitHub Actions / lint

file=R/utils_accessibility.R,line=144,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
selected <- shiny::restoreInput(id = inputId, default = selected)

Check warning on line 146 in R/utils_accessibility.R

View workflow job for this annotation

GitHub Actions / lint

file=R/utils_accessibility.R,line=146,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
selected <- if (is.null(selected)) args$choiceValues[[1]] else as.character(selected)
if (length(selected) > 1) stop("The 'selected' argument must be of length 1")

Check warning on line 149 in R/utils_accessibility.R

View workflow job for this annotation

GitHub Actions / lint

file=R/utils_accessibility.R,line=149,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
options <- shiny:::generateOptions(
inputId, selected, inline, "radio", args$choiceNames, args$choiceValues
)

Check warning on line 153 in R/utils_accessibility.R

View workflow job for this annotation

GitHub Actions / lint

file=R/utils_accessibility.R,line=153,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
divClass <- "form-group shiny-input-radiogroup shiny-input-container"

Check warning on line 154 in R/utils_accessibility.R

View workflow job for this annotation

GitHub Actions / lint

file=R/utils_accessibility.R,line=154,col=3,[object_name_linter] Variable and function name style should match snake_case or symbols.
if (inline) divClass <- paste(divClass, "shiny-input-container-inline")

Check warning on line 155 in R/utils_accessibility.R

View workflow job for this annotation

GitHub Actions / lint

file=R/utils_accessibility.R,line=155,col=15,[object_name_linter] Variable and function name style should match snake_case or symbols.

Check warning on line 156 in R/utils_accessibility.R

View workflow job for this annotation

GitHub Actions / lint

file=R/utils_accessibility.R,line=156,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
tags$fieldset(
tags$legend(label),
tags$div(
id = inputId,
style = htmltools::css(width = validateCssUnit(width)),
class = divClass,
role = "radiogroup",
options
)
)
}

#' accessible_action_link
#'
#' @param ... action link text
#'
#' @noRd
#'
accessible_action_link <- function(inputId, label, icon = NULL, ...) {
value <- restoreInput(id = inputId, default = NULL)
tags$a(id = inputId, href = "#", class = "action-button",
`data-val` = value, style = "color: #004280; text-decoration: underline;",
list(shiny:::validateIcon(icon), label),
...)
}
3 changes: 0 additions & 3 deletions inst/app/www/assets/favicons/favicon.svg

This file was deleted.

2 changes: 1 addition & 1 deletion man/nhs_selectizeInput.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9a142d2

Please sign in to comment.