diff --git a/base.js b/base.js index cd20236..c4d76ec 100644 --- a/base.js +++ b/base.js @@ -241,6 +241,11 @@ trigger.focus(); } } + // Announce the close so whoever opened the modal can undo optimistic UI or + // clean up a dynamically-inserted overlay. A modal can be dismissed four + // ways — the ✕ button, a Cancel button, a backdrop click, and Escape — and + // the last two are handled globally here, so button-only listeners miss them. + el.dispatchEvent(new CustomEvent('lt:modalclose', { bubbles: true })); } function closeAllModals() {