Skip to content

Commit

Permalink
docs(tagAppendAttributes): Improve guidance for boolean attributes (#427
Browse files Browse the repository at this point in the history
)
  • Loading branch information
gadenbuie authored Mar 19, 2024
1 parent f8e0591 commit 30d13a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* The fill CSS attached to fillable containers and fill items with `bindFillRole()` now uses a [CSS cascade layer](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Cascade_layers) named `htmltools` to reduce the precedence order of the fill CSS. (#425)

* Improved documentation for boolean attributes in `tagAppendAttributes()` to note that they can be set via an `NA` value, e.g. `tagAppendAttributes(div(), contenteditable = NA)` creates `<div contenteditable></div>`. (thanks @russHyde, #427)

## Bug fixes

* `bindFillRole()` now attaches its `HTMLDependency()` to fill items, thus reducing the possibility of filling layout breaking due to missing CSS. (#421)
Expand Down
5 changes: 4 additions & 1 deletion R/tags.R
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,9 @@ tagAddRenderHook <- function(tag, func, replace = FALSE) {
#'
#' @export
#' @param tag a [tag] object.
#' @param ... a collection of attributes.
#' @param ... Attributes to append as named argument-value pairs. A named
#' argument with an `NA` value is rendered as a boolean attribute (see
#' example).
#' @param .cssSelector A character string containing a [CSS
#' selector](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors)
#' for targeting particular (inner) tags of interest. At the moment, only a
Expand All @@ -423,6 +425,7 @@ tagAddRenderHook <- function(tag, func, replace = FALSE) {
#' html <- div(a())
#' tagAppendAttributes(html, class = "foo")
#' tagAppendAttributes(html, .cssSelector = "a", class = "bar")
#' tagAppendAttributes(html, contenteditable = NA)
#'
#' tagHasAttribute(div(foo = "bar"), "foo")
#' tagGetAttribute(div(foo = "bar"), "foo")
Expand Down
5 changes: 4 additions & 1 deletion man/tagAppendAttributes.Rd

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

0 comments on commit 30d13a1

Please sign in to comment.