Skip to content

Commit

Permalink
Update modal component so that plugins load with dynamic content
Browse files Browse the repository at this point in the history
Fixes #314
  • Loading branch information
KarelJanVanHaute committed Apr 18, 2024
1 parent 6d33c7a commit 124ca83
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tailoff/js/components/modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { SiteLang } from '../utils/site-lang';
import { A11yUtils } from '../utils/a11y';
import 'wicg-inert';
import { ModalPlugin, ModalPluginConstructor } from '../plugins/modal/plugin.interface';
import { DOMHelper } from '../utils/domHelper';

export class ModalComponent {
private siteLang = SiteLang.getLang();
Expand Down Expand Up @@ -64,6 +65,12 @@ export class ModalComponent {
Array.from(triggers).forEach((trigger) => {
this.initTrigger(trigger);
});

DOMHelper.onDynamicContent(document.documentElement, `.${p.getTriggerClass()}`, (triggers) => {
Array.from(triggers).forEach((trigger: Element) => {
this.initTrigger(trigger);
});
});
});
}
}
Expand Down

0 comments on commit 124ca83

Please sign in to comment.