Added htmlAppendAttributes method and fixed accessibility with help link icons (title -> aria-label)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Package: AVSDevR.HTMLUtils
|
||||
Title: Utility Functions For Modifying R HTML Elements
|
||||
Version: 0.1.0
|
||||
Version: 0.1.0.9000
|
||||
Authors@R:
|
||||
person("Craig", "Williams", , "craig@avsdev.uk", role = c("aut", "cre"))
|
||||
Description: Collection of utility functions for modifying HTML markup of
|
||||
|
||||
@@ -4,6 +4,7 @@ export(htmlAddBoxAttributes)
|
||||
export(htmlAddBoxHelpLink)
|
||||
export(htmlAddBoxRegionFromTitle)
|
||||
export(htmlAddClasses)
|
||||
export(htmlAppendAttributes)
|
||||
export(htmlButtonStyle)
|
||||
export(htmlDisableAutocomplete)
|
||||
export(htmlFixBoxCollapseButtonAria)
|
||||
|
||||
14
R/htmlAppendAttributes.R
Normal file
14
R/htmlAppendAttributes.R
Normal file
@@ -0,0 +1,14 @@
|
||||
#' Appends attributes to an HTML element
|
||||
#'
|
||||
#' @param el The element to append the attributes to
|
||||
#' @param ... The attribute names to be appended
|
||||
#'
|
||||
#' @return The modified element
|
||||
#' @export
|
||||
#'
|
||||
#' @examples
|
||||
#' x <- shiny::icon("wrench")
|
||||
#' htmlAppendAttributes(x, `role` = "presentation")
|
||||
htmlAppendAttributes <- function(el, ...) {
|
||||
do.call(htmltools::tagQuery(el)$addAttrs, list(...))$allTags()
|
||||
}
|
||||
@@ -135,7 +135,8 @@ htmlAddBoxHelpLink <- function(box, href, title = NULL) {
|
||||
target = "_blank",
|
||||
class = "btn btn-box-tool pl-3 pr-3",
|
||||
htmlRemoveAttributes(shiny::icon("question"), "aria-label"),
|
||||
title = paste(trimws(title), " help link")
|
||||
title = paste(trimws(title), " help link"),
|
||||
`aria-label` = paste(trimws(title), " help link")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
23
man/htmlAppendAttributes.Rd
Normal file
23
man/htmlAppendAttributes.Rd
Normal file
@@ -0,0 +1,23 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/htmlAppendAttributes.R
|
||||
\name{htmlAppendAttributes}
|
||||
\alias{htmlAppendAttributes}
|
||||
\title{Appends attributes to an HTML element}
|
||||
\usage{
|
||||
htmlAppendAttributes(el, ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{el}{The element to append the attributes to}
|
||||
|
||||
\item{...}{The attribute names to be appended}
|
||||
}
|
||||
\value{
|
||||
The modified element
|
||||
}
|
||||
\description{
|
||||
Appends attributes to an HTML element
|
||||
}
|
||||
\examples{
|
||||
x <- shiny::icon("wrench")
|
||||
htmlAppendAttributes(x, `role` = "presentation")
|
||||
}
|
||||
Reference in New Issue
Block a user