akiran / akiran/react-foundation-apps

The modal's overlay allows closing without an event

Open
#34 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
291
Forks
45
PR merge metrics
No merged PRs in 30d

Description

Their is no way to detect when a user clicks away from the model (on the background) triggering it to close. The event happens here when it calls `this.setState({open: false})`:

https://github.com/akiran/react-foundation-apps/blob/master/src/modal/index.jsx#L35

``` javascript
hideOverlay: function (e) {
e.preventDefault();
if (this.props.overlayClose) {
this.setState({open: false});
}
},
```

In our case, we can't use `componentWillUnmount`, we are using a global model that remains mounted the entire life of the app. When subscribed to the model `ZfApi.subscribe(this.props.modalId, (name, msg) => {` it would be ideal to see a "close" event issued for the `overlayClose` in addition to the `X` and `Cancel`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.