From 464b8917b9db9195a54c3d8def8bc3578a00e283 Mon Sep 17 00:00:00 2001 From: Erik Rothoff Andersson Date: Tue, 26 May 2020 23:18:39 +0200 Subject: [PATCH 1/3] Make basic-dialog take into account changes in clickOutsideToclose --- addon/components/basic-dialog.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addon/components/basic-dialog.js b/addon/components/basic-dialog.js index c246d248..6637686b 100644 --- a/addon/components/basic-dialog.js +++ b/addon/components/basic-dialog.js @@ -103,6 +103,10 @@ export default class BasicDialog extends Component { this.makeOverlayClickableOnIOS(); this.handleClick = ({ target }) => { + if (!this.get('clickOutsideToClose')) { + return; + } + // if the click has already resulted in the target // being removed or hidden, do nothing if (target.offsetWidth === 0 && target.offsetHeight === 0) { From c9f2938d3dbc5ed725a87822a2a7a87fd46318dc Mon Sep 17 00:00:00 2001 From: Erik Rothoff Andersson Date: Tue, 26 May 2020 23:23:28 +0200 Subject: [PATCH 2/3] Implement a new attribute to validate close clicks --- addon/components/basic-dialog.js | 3 +++ addon/templates/components/modal-dialog.hbs | 1 + 2 files changed, 4 insertions(+) diff --git a/addon/components/basic-dialog.js b/addon/components/basic-dialog.js index 6637686b..d8c87418 100644 --- a/addon/components/basic-dialog.js +++ b/addon/components/basic-dialog.js @@ -127,6 +127,9 @@ export default class BasicDialog extends Component { if (modalEl && modalEl.contains(target)) { return; } + if (this.shouldIgnoreCloseClick && this.shouldIgnoreCloseClick(modalEl, target)) { + return; + } if (this.onClose) { this.onClose(); } diff --git a/addon/templates/components/modal-dialog.hbs b/addon/templates/components/modal-dialog.hbs index 34e7a871..06eaa0a0 100644 --- a/addon/templates/components/modal-dialog.hbs +++ b/addon/templates/components/modal-dialog.hbs @@ -25,6 +25,7 @@ value=this.value onClickOverlay=this.onClickOverlayAction onClose=this.onCloseAction + shouldIgnoreCloseClick=this.shouldIgnoreCloseClick }} {{yield}} {{/component}} From 71f392afa5707f61d62a4d1e48b30b9b52946c22 Mon Sep 17 00:00:00 2001 From: Erik Rothoff Andersson Date: Mon, 30 Aug 2021 23:16:45 +0200 Subject: [PATCH 3/3] Update README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cc3baca2..a331ff90 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,7 @@ Property | Purpose `wrapperClass` | CSS class name(s) to append to wrapper divs. Set this from template. `wrapperClassNames` | CSS class names to append to wrapper divs. If you subclass this component, you may define this in your subclass.) `animatable` | A boolean, when `true` makes modal animatable using `liquid-fire` (requires `liquid-wormhole` to be installed, and for tethering situations `liquid-tether`. Having these optional dependencies installed and not specifying `animatable` will make `animatable=true` be the default.) +`shouldIgnoreCloseClick`| A function, when returning `true` does not close #### Tethering