ngneat / dialog

👻 A simple to use, highly customizable, and powerful modal for Angular Applications
https://ngneat.github.io/dialog/
MIT License
394 stars 38 forks source link

Closing with escape closes all open modals #96

Closed milo526 closed 1 year ago

milo526 commented 1 year ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

In situations where there are multiple opened modals that are stacked over each other; closing with Escape results in all of the modals being closed. Clicking the backdrop only dismisses the top modal.

Expected behavior

Making the behavior of the Escape-close inline with the backdrop-close, pressing Escape with multiple opened modals should only close the top one.

Minimal reproduction of the problem with instructions

Open multiple modals with enableClose: true, press Escape.

What is the motivation / use case for changing the behavior?

We use modal's to have our users update their models/data. If changes have been made to the model but not yet saved; we ask them for a confirmation if they close the edit modal. This confirmation is another modal stacked on top of the edit modal. Pressing escape (on the confirmation modal) should close the confirmation modal but not the underlying edit modal.

Environment


Angular version: 15.1.1


Browser:
- [x] Chrome (desktop) version Latest
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [x] Firefox version Latest
- [x] Safari (desktop) version Latest
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX

Probably also other versions; but these I have confirmed, it does not seem to be a browser issue.

For Tooling issues:
- Node version: XX  
- Platform:  

Others:

NetanelBasal commented 1 year ago

You're welcome to submit a PR