Skip to content

Commit 51f653b

Browse files
authored
v1.11.1 release candidate (#4245)
* v1.11.1 release candidate * `yarn build` (GitHub Actions) * Revert actionButton()/actionLink() implementation to v1.11.0's behavior (re-introducing #4239) * Minimal fix to address the regression in #4239 Ideally we'd fix this issue, and also get updateActionButton() working with HTML labels, but thanks to today's release of kinesis (which snapshots all of actionButton()s markup), and CRAN dragging their feet to accept our original submission (which was fine, by the way), we can't have nice things * `yarn build` (GitHub Actions) --------- Co-authored-by: cpsievert <[email protected]>
1 parent 460a93a commit 51f653b

File tree

20 files changed

+99
-256
lines changed

20 files changed

+99
-256
lines changed

DESCRIPTION

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: shiny
22
Type: Package
33
Title: Web Application Framework for R
4-
Version: 1.11.0.9000
4+
Version: 1.11.1
55
Authors@R: c(
66
person("Winston", "Chang", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0002-1576-2126")),
77
person("Joe", "Cheng", role = "aut", email = "[email protected]"),
@@ -202,7 +202,6 @@ Collate:
202202
'test.R'
203203
'update-input.R'
204204
'utils-lang.R'
205-
'utils-tags.R'
206205
'version_bs_date_picker.R'
207206
'version_ion_range_slider.R'
208207
'version_jquery.R'

NEWS.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
# shiny (development version)
1+
# shiny 1.11.1
22

3-
## New features
4-
5-
* The `icon` argument of `actionButton()`, `downloadButton()`, etc. now accepts values other than `shiny::icon()` (like `fontawesome::fa()` and `bsicons::bs_icon()`). (#4242)
6-
7-
## Improvements
3+
This is a patch release primarily for addressing the bugs introduced in v1.11.0.
84

9-
* Padding is now provided between the `icon` and `label` of an `actionButton()`. (#4242)
105
## Bug fixes
116

12-
* Fixed a regression in v1.11.0 where `InputBinding` implementations that don't pass a value to their `subscribe` callback were no longer notifying Shiny of input changes. (#4243)
7+
* Fixed an issue where `InputBinding` implementations that don't pass a value to their `subscribe` callback were no longer notifying Shiny of input changes. (#4243)
138

14-
* `updateActionButton()` and `updateActionLink()` once again handle `label` updates correctly (which can now include HTML). (#4242)
9+
* `updateActionButton()` and `updateActionLink()` once again handle `label` updates correctly. (#4245)
1510

1611
# shiny 1.11.0
1712

R/input-action.R

Lines changed: 21 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,13 @@ actionButton <- function(inputId, label, icon = NULL, width = NULL,
5656

5757
value <- restoreInput(id = inputId, default = NULL)
5858

59-
tags$button(
60-
id = inputId,
59+
tags$button(id=inputId,
6160
style = css(width = validateCssUnit(width)),
62-
type = "button",
63-
class = "btn btn-default action-button",
61+
type="button",
62+
class="btn btn-default action-button",
6463
`data-val` = value,
6564
disabled = if (isTRUE(disabled)) NA else NULL,
66-
get_action_children(label, icon),
65+
list(validateIcon(icon), label),
6766
...
6867
)
6968
}
@@ -73,52 +72,30 @@ actionButton <- function(inputId, label, icon = NULL, width = NULL,
7372
actionLink <- function(inputId, label, icon = NULL, ...) {
7473
value <- restoreInput(id = inputId, default = NULL)
7574

76-
tags$a(
77-
id = inputId,
78-
href = "#",
79-
class = "action-button",
75+
tags$a(id=inputId,
76+
href="#",
77+
class="action-button",
8078
`data-val` = value,
81-
get_action_children(label, icon),
79+
list(validateIcon(icon), label),
8280
...
8381
)
8482
}
8583

86-
get_action_children <- function(label, icon) {
87-
icon <- validateIcon(icon)
8884

89-
if (length(icon) > 0) {
90-
# The separator elements helps us distinguish between the icon and label
91-
# when dynamically updating the button/link. Ideally, we would wrap each
92-
# in a container element, but is currently done with a separator to help
93-
# minimize the chance of breaking existing code.
94-
tagList(
95-
icon,
96-
tags$span(class = "shiny-icon-separator"),
97-
label
98-
)
99-
} else {
100-
# Technically, we don't need the `icon` here, but keeping it maintains
101-
# backwards compatibility of `btn$children[[1]][[2]]` to get the label.
102-
# The shinyGovstyle package is at least one example of this.
103-
tagList(icon, label)
104-
}
105-
}
106-
107-
# Throw an informative warning if icon isn't html-ish
85+
# Check that the icon parameter is valid:
86+
# 1) Check if the user wants to actually add an icon:
87+
# -- if icon=NULL, it means leave the icon unchanged
88+
# -- if icon=character(0), it means don't add an icon or, more usefully,
89+
# remove the previous icon
90+
# 2) If so, check that the icon has the right format (this does not check whether
91+
# it is a *real* icon - currently that would require a massive cross reference
92+
# with the "font-awesome" and the "glyphicon" libraries)
10893
validateIcon <- function(icon) {
109-
if (length(icon) == 0) {
94+
if (is.null(icon) || identical(icon, character(0))) {
11095
return(icon)
96+
} else if (inherits(icon, "shiny.tag") && icon$name == "i") {
97+
return(icon)
98+
} else {
99+
stop("Invalid icon. Use Shiny's 'icon()' function to generate a valid icon")
111100
}
112-
113-
if (!isTagLike(icon)) {
114-
rlang::warn(
115-
c(
116-
"It appears that a non-HTML value was provided to `icon`.",
117-
i = "Try using a `shiny::icon()` (or an equivalent) to get an icon."
118-
),
119-
class = "shiny-validate-icon"
120-
)
121-
}
122-
123-
icon
124101
}

R/update-input.R

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,22 +181,14 @@ updateCheckboxInput <- function(session = getDefaultReactiveDomain(), inputId, l
181181
updateActionButton <- function(session = getDefaultReactiveDomain(), inputId, label = NULL, icon = NULL, disabled = NULL) {
182182
validate_session_object(session)
183183

184-
message <- dropNulls(list(
185-
label = if (!is.null(label)) processDeps(label, session),
186-
icon = if (!is.null(icon)) processDeps(validateIcon(icon), session),
187-
disabled = disabled
188-
))
184+
if (!is.null(icon)) icon <- as.character(validateIcon(icon))
185+
message <- dropNulls(list(label=label, icon=icon, disabled=disabled))
189186
session$sendInputMessage(inputId, message)
190187
}
191188
#' @rdname updateActionButton
192189
#' @export
193190
updateActionLink <- function(session = getDefaultReactiveDomain(), inputId, label = NULL, icon = NULL) {
194-
updateActionButton(
195-
session,
196-
inputId = inputId,
197-
label = label,
198-
icon = icon
199-
)
191+
updateActionButton(session, inputId=inputId, label=label, icon=icon)
200192
}
201193

202194

R/utils-tags.R

Lines changed: 0 additions & 21 deletions
This file was deleted.

inst/www/shared/busy-indicators/busy-indicators.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inst/www/shared/shiny-autoreload.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inst/www/shared/shiny-showcase.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inst/www/shared/shiny-showcase.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inst/www/shared/shiny-testmode.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)