frayerjj-frontend 0.2.12 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/modal.js +14 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frayerjj-frontend",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "My base frontend for various projects",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/modal.js CHANGED
@@ -272,17 +272,21 @@ export const modal = {
272
272
  },
273
273
 
274
274
  show: config => {
275
+ modal.close();
276
+ message.verbose('Showing Modal');
275
277
  document.body.appendChild(modal.build.modal(config));
276
- let modalEl = document.getElementById(config.id);
277
- let bsModal = new bootstrap.Modal(modalEl);
278
- modalEl.addEventListener('hidden.bs.modal', () => modalEl.remove());
279
- modalEl.querySelectorAll('[data-action]').forEach(button =>
280
- button.addEventListener('click', () => {
281
- if (config[button.dataset.action]) config[button.dataset.action]();
282
- bsModal.hide();
283
- })
284
- );
285
- bsModal.show();
278
+ setTimeout(() => {
279
+ let modalEl = document.getElementById(config.id);
280
+ let bsModal = new bootstrap.Modal(modalEl);
281
+ modalEl.addEventListener('hidden.bs.modal', () => modalEl.remove());
282
+ modalEl.querySelectorAll('[data-action]').forEach(button =>
283
+ button.addEventListener('click', () => {
284
+ if (config[button.dataset.action]) config[button.dataset.action]();
285
+ bsModal.hide();
286
+ })
287
+ );
288
+ bsModal.show();
289
+ }, 100); // Delay to allow DOM to update
286
290
  }
287
291
 
288
292
  };