Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions addon/components/basic-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -123,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();
}
Expand Down
1 change: 1 addition & 0 deletions addon/templates/components/modal-dialog.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
value=this.value
onClickOverlay=this.onClickOverlayAction
onClose=this.onCloseAction
shouldIgnoreCloseClick=this.shouldIgnoreCloseClick
}}
{{yield}}
{{/component}}