From 5127e7d06396de4cc60f3af5ff3cf12c27a795dd Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Fri, 25 Sep 2020 13:00:44 -0400 Subject: [PATCH] Ensure that readyCallback is called on modals opened from other modals --- framework/core/js/src/common/components/ModalManager.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/framework/core/js/src/common/components/ModalManager.js b/framework/core/js/src/common/components/ModalManager.js index 35922f70d..1b063552e 100644 --- a/framework/core/js/src/common/components/ModalManager.js +++ b/framework/core/js/src/common/components/ModalManager.js @@ -28,6 +28,13 @@ export default class ModalManager extends Component { animateShow(readyCallback) { const dismissible = !!this.attrs.state.modal.componentClass.isDismissible; + // If we are opening this modal while another modal is already open, + // the shown event will not run, because the modal is already open. + // So, we need to manually trigger the readyCallback. + if (this.$().hasClass('in')) { + readyCallback(); + } + this.$() .one('shown.bs.modal', readyCallback) .modal({