Skip to content

Commit d2d4b66

Browse files
committed
make hide() work with {shinycssloaders}; fixes #276
1 parent 08c2a76 commit d2d4b66

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: shinyjs
22
Title: Easily Improve the User Experience of Your Shiny Apps in Seconds
3-
Version: 2.1.0.9006
3+
Version: 2.1.0.9007
44
Authors@R: person("Dean", "Attali",
55
email = "[email protected]",
66
role = c("aut", "cre"),

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- **BREAKING CHANGE** The `useShinyjs()` function no longer accepts any parameters. The `rmd` and `html` arguments are not needed (they are now detected automatically). The `debug` argument is now set using R options: `options("shinyjs.debug" = TRUE)`.
44
- **DEPRECATION NOTICE** The `runExample()` function is no longer required since {shiny} version 1.8.1 (March 2024). You can now use `shiny::runExample("demo", package = "shinyjs")` instead of `shinyjs::runExample("demo")`.
5+
- Fix bug: `hide()` now works with spinners from {shinycssloaders} (#276)
56
- Fix bug: `hidden()` and `disabled()` now work with tags that have a `htmlDependency()` (#252)
67
- Fix bug: `hidden()` and `disabled()` now return a `tagList()` instead of a `list()` when appropriate
78
- Fix bug: `disable()` now works with file inputs (#249)

inst/srcjs/shinyjs-default-funcs.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ shinyjs = function() {
4343
}
4444
};
4545

46-
// if the given HTML tag is a shiny input, return the input container.
47-
// otherwise, return the original tag
46+
// if the given HTML tag is a shiny input or is wrapped in a {shinycssloaders} spinner,
47+
// return the container. Otherwise, return the original tag
4848
var _getContainer = function(els) {
4949
return $.map(els, function(el) {
5050
el = $(el);
@@ -53,6 +53,11 @@ shinyjs = function() {
5353
if (inputContainer.length > 0) {
5454
el = inputContainer;
5555
}
56+
} else if (el.hasClass("shiny-bound-output")) {
57+
let outputContainer = el.closest(".shiny-spinner-output-container");
58+
if (outputContainer.length > 0) {
59+
el = outputContainer;
60+
}
5661
}
5762
return el;
5863
});

0 commit comments

Comments
 (0)