diff --git a/README.md b/README.md index 428a82e1..f894cada 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,4 @@ Not recommended for general use, this package will be removed if upstream become Custom changes: - added `allowOutsideClick` passthrough from the `modals` service to the `focus-trap` initialisation so `clickOutsideDeactivates` and `allowOutsideClick` and be used in tandem to allow wormholed content such as dropdowns to work inside of a modal +- added `escapeDeactivates` passthrough from the `modals` service to the `focus-trap` initialisation so that deactivation/close event handling can be fully controlled by the consuming app diff --git a/addon/components/modal.js b/addon/components/modal.js index 8ad66da9..061a22f1 100644 --- a/addon/components/modal.js +++ b/addon/components/modal.js @@ -30,11 +30,12 @@ export default Component.extend({ didInsertElement() { this._super(...arguments); - let { allowOutsideClick, clickOutsideDeactivates } = this.modals; + let { allowOutsideClick, clickOutsideDeactivates, escapeDeactivates } = this.modals; let element = document.getElementById(this.modalElementId); let options = { allowOutsideClick, clickOutsideDeactivates, + escapeDeactivates, fallbackFocus: `#${this.modalElementId}`, onDeactivate: () => { if (this.isDestroyed || this.isDestroying) { diff --git a/addon/services/modals.js b/addon/services/modals.js index 13df0f93..ac2edf42 100644 --- a/addon/services/modals.js +++ b/addon/services/modals.js @@ -11,8 +11,9 @@ export default Service.extend({ }), top: alias('_stack.lastObject'), - allowOutsideClick: undefined, + allowOutsideClick: false, clickOutsideDeactivates: true, + escapeDeactivates: true, init() { this._super(...arguments);