Skip to content

Commit

Permalink
fix: Schedule .modal("hide") for transitioning modals (#4173)
Browse files Browse the repository at this point in the history
* fix: Schedule modal removal for transitioning modals

* refactor: Simplify and both call and schedule modal hiding at same time

* Increment version number to 1.10.0.9000

* docs: Add NEWS entry
  • Loading branch information
gadenbuie authored Dec 31, 2024
1 parent 79f42f5 commit 13ca8df
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 21 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: shiny
Type: Package
Title: Web Application Framework for R
Version: 1.10.0
Version: 1.10.0.9000
Authors@R: c(
person("Winston", "Chang", role = c("aut", "cre"), email = "winston@posit.co", comment = c(ORCID = "0000-0002-1576-2126")),
person("Joe", "Cheng", role = "aut", email = "joe@posit.co"),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# shiny (development version)

## Bug fixes

* Fixed a bug with modals where calling `removeModal()` too quickly after `showModal()` would fail to remove the modal if the remove modal message was received while the modal was in the process of being revealed. (#4173)

# shiny 1.10.0

## New features and improvements
Expand Down
2 changes: 1 addition & 1 deletion inst/www/shared/busy-indicators/busy-indicators.css

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

2 changes: 1 addition & 1 deletion inst/www/shared/shiny-autoreload.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/www/shared/shiny-showcase.css

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

2 changes: 1 addition & 1 deletion inst/www/shared/shiny-showcase.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/www/shared/shiny-testmode.js

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

12 changes: 8 additions & 4 deletions inst/www/shared/shiny.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! shiny 1.10.0 | (c) 2012-2024 RStudio, PBC. | License: GPL-3 | file LICENSE */
/*! shiny 1.10.0.9000 | (c) 2012-2024 RStudio, PBC. | License: GPL-3 | file LICENSE */
"use strict";
(function() {
var __create = Object.create;
Expand Down Expand Up @@ -21315,8 +21315,12 @@
function remove() {
var $modal = (0, import_jquery35.default)("#shiny-modal-wrapper");
$modal.off("keydown.shinymodal");
if ($modal.find(".modal").length > 0) {
$modal.find(".modal").modal("hide");
var $bsModal = $modal.find(".modal");
if ($bsModal.length > 0) {
$bsModal.on("shown.bs.modal", function() {
return $bsModal.modal("hide");
});
$bsModal.modal("hide");
} else {
shinyUnbindAll($modal);
$modal.remove();
Expand Down Expand Up @@ -25165,7 +25169,7 @@
_defineProperty23(this, "initializeInputs", void 0);
_defineProperty23(this, "initializedPromise", void 0);
_defineProperty23(this, "oncustommessage", void 0);
this.version = "1.10.0";
this.version = "1.10.0.9000";
var _initInputBindings = initInputBindings(), inputBindings = _initInputBindings.inputBindings, fileInputBinding2 = _initInputBindings.fileInputBinding;
var _initOutputBindings = initOutputBindings(), outputBindings = _initOutputBindings.outputBindings;
setFileInputBinding(fileInputBinding2);
Expand Down
4 changes: 2 additions & 2 deletions inst/www/shared/shiny.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/www/shared/shiny.min.css

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

4 changes: 2 additions & 2 deletions inst/www/shared/shiny.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions inst/www/shared/shiny.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"homepage": "https://shiny.rstudio.com",
"repository": "github:rstudio/shiny",
"name": "@types/rstudio-shiny",
"version": "1.10.0",
"version": "1.10.0-alpha.9000",
"license": "GPL-3.0-only",
"main": "",
"browser": "",
Expand Down
8 changes: 6 additions & 2 deletions srcts/src/shiny/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ function remove(): void {
// Look for a Bootstrap modal and if present, trigger hide event. This will
// trigger the hidden.bs.modal callback that we set in show(), which unbinds
// and removes the element.
if ($modal.find(".modal").length > 0) {
$modal.find(".modal").modal("hide");
const $bsModal = $modal.find(".modal");
if ($bsModal.length > 0) {
// We both hide the modal when its shown and also immediately; the immediate
// version is a no-op in Bootstrap if called before the modal is fully shown
$bsModal.on("shown.bs.modal", () => $bsModal.modal("hide"));
$bsModal.modal("hide");
} else {
// If not a Bootstrap modal dialog, simply unbind and remove it.
shinyUnbindAll($modal);
Expand Down

0 comments on commit 13ca8df

Please sign in to comment.