Skip to content

Commit

Permalink
fix(modal,flyout): dynamic elements did not reference
Browse files Browse the repository at this point in the history
Whenever a flyout or modal were dynamically created, the internal element has to be reassigned, otherwise it would always be body. This is especially important when mutationobservers or this-references in callbacks are used
  • Loading branch information
lubber-de committed Oct 5, 2022
1 parent 7441393 commit b4c60c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/definitions/modules/flyout.js
Expand Up @@ -168,7 +168,6 @@ $.flyout = $.fn.flyout = function(parameters) {
module.setup.heights();
module.bind.resize();
}
module.refreshInputs();
module.bind.events();
module.observeChanges();
module.instantiate();
Expand Down Expand Up @@ -208,6 +207,7 @@ $.flyout = $.fn.flyout = function(parameters) {
$('<div/>', {class: className.actions}).appendTo($module);
}
$module.prependTo($context);
element = $module[0];
},
id: function() {
id = (Math.random().toString(16) + '000000000').slice(2, 10);
Expand Down Expand Up @@ -621,6 +621,7 @@ $.flyout = $.fn.flyout = function(parameters) {
module.add.keyboardShortcuts();
}
module.save.focus();
module.refreshInputs();
if(settings.autofocus) {
module.set.autofocus();
}
Expand Down
3 changes: 2 additions & 1 deletion src/definitions/modules/modal.js
Expand Up @@ -153,7 +153,6 @@ $.modal = $.fn.modal = function(parameters) {
$module.addClass('top aligned');
}
module.refreshModals();
module.refreshInputs();
module.bind.events();
module.observeChanges();
module.instantiate();
Expand Down Expand Up @@ -191,6 +190,7 @@ $.modal = $.fn.modal = function(parameters) {
$('<div/>', {class: className.actions}).appendTo($module);
}
$context.append($module);
element = $module[0];
},
dimmer: function() {
var
Expand Down Expand Up @@ -574,6 +574,7 @@ $.modal = $.fn.modal = function(parameters) {
}
module.save.focus();
module.set.active();
module.refreshInputs()
if(settings.autofocus) {
module.set.autofocus();
}
Expand Down

0 comments on commit b4c60c1

Please sign in to comment.