|
@@ -19,6 +19,9 @@ function ModalWorkflow(opts) {
|
|
|
'onload' (optional): dict of callbacks to be called when loading a step of the workflow.
|
|
|
The 'step' field in the response identifies the callback to call, passing it the
|
|
|
modal object and response data as arguments
|
|
|
+ 'triggerElement' (optional): element that triggered the modal.
|
|
|
+ It will be disabled while the modal is shown.
|
|
|
+ If not provided, defaults to `document.activeElement` (which may not work as expected in Safari).
|
|
|
*/
|
|
|
|
|
|
const self = {};
|
|
@@ -37,8 +40,11 @@ function ModalWorkflow(opts) {
|
|
|
|
|
|
$('body > .modal').remove();
|
|
|
|
|
|
-
|
|
|
- self.triggerElement = document.activeElement;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ self.triggerElement = opts.triggerElement || document.activeElement;
|
|
|
self.triggerElement.setAttribute('disabled', true);
|
|
|
|
|
|
|
|
@@ -61,6 +67,8 @@ function ModalWorkflow(opts) {
|
|
|
self.container.on('hide.bs.modal', () => {
|
|
|
if (!self.triggerElement.hasAttribute('data-force-disabled')) {
|
|
|
self.triggerElement.removeAttribute('disabled');
|
|
|
+
|
|
|
+ self.triggerElement.removeAttribute('data-w-progress-loading-value');
|
|
|
}
|
|
|
});
|
|
|
|