Skip to content

Commit b889b0d

Browse files
authored
Merge pull request #2582 from rstudio/barret_showcase_hidden_wide
Fix showcase bug where hidden by default on wide window
2 parents 2e0221e + ba5733e commit b889b0d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ shiny 1.3.2.9001
5252

5353
* Fixed [rstudio/reactlog#36](https://github.com/rstudio/reactlog/issues/36): Changes to reactive values not displaying accurately in reactlog. ([#2424](https://github.com/rstudio/shiny/pull/2424))
5454

55+
* Fixed [#2598](https://github.com/rstudio/shiny/issues/2598): Showcase files don't appear with a wide window. ([#2582](https://github.com/rstudio/shiny/pull/2582))
56+
5557
* Fixed [#2329](https://github.com/rstudio/shiny/issues/2329), [#1817](https://github.com/rstudio/shiny/issues/1817): These bugs were reported as fixed in Shiny 1.3.0 but were not actually fixed because some JavaScript changes were accidentally not included in the release. The fix resolves issues that occur when `withProgressBar()` or bookmarking are combined with the [networkD3](https://christophergandrud.github.io/networkD3/) package's Sankey plot.
5658

5759
### Library updates

inst/www/shared/shiny-showcase.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@
8383
el.id = "srcref_" + srcref;
8484
var ref = srcref;
8585
var code = document.getElementById(srcfile.replace(/\./g, "_") + "_code");
86+
// if there is no code file (might be a shiny file), quit early
87+
if (!code) return;
8688
var start = findTextPoint(code, ref[0], ref[4]);
8789
var end = findTextPoint(code, ref[2], ref[5]);
8890

@@ -148,6 +150,8 @@
148150
}
149151
}
150152

153+
// hide the new element before doing anything to it
154+
$(newHostElement).hide();
151155
$(currentHostElement).fadeOut(animateCodeMs, function() {
152156
var tabs = document.getElementById("showcase-code-tabs");
153157
currentHostElement.removeChild(tabs);
@@ -160,7 +164,7 @@
160164
document.getElementById("showcase-code-content").removeAttribute("style");
161165
}
162166

163-
$(newHostElement).fadeIn();
167+
$(newHostElement).fadeIn(animateCodeMs);
164168
if (!above) {
165169
// remove the applied width and zoom on the app container, and
166170
// scroll smoothly down to the code's new home
@@ -189,7 +193,6 @@
189193
if (above) {
190194
$(document.body).animate({ scrollTop: 0 }, animateCodeMs);
191195
}
192-
$(newHostElement).hide();
193196
isCodeAbove = above;
194197
setAppCodeSxsWidths(above && animate);
195198
$(window).trigger("resize");

0 commit comments

Comments
 (0)