New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dismissing one of stacked modals dismisses keyboard/backdrop events for all modals #3515
Comments
I guess this behavior because of the returned Promise in @pkozlowski-opensource @maxokorokov I changed to resolve the promise when is dismissing in I try to make PR for this issue |
I think promise rejection is the intended way to dismiss a modal, so we can distinguish between a negative result and no result. The first opened modal can still be dismissed by calling activeModal.dismiss. My guess was the keyboard and backdrop event listeners are detached before 'beforeDismiss' is called. |
I don't think we do anything special about keyboard events in here. We rely on rxjs |
I tinkered a little bit more and discovered that you can dismiss the first modal by calling activeModal.dismiss() and dismiss the second modal by keyboard/backdrop any number of times before this bug appears, this only happens once you dismiss the first modal by keyboard/backdrop. I haven't looked under the hood but shouldn't that point to slightly different implementation of the keyboard/backdrop events? |
I have this bug too, also with the scenario of a confirmation modal. Had to reverted to an earlier version. I'm pretty sure it has to do with this change. More precisely with unsubscribing the dismissEvent using |
At the moment key/mouse handlers are removed when modal triggers dismiss event. The problem is that modal closure could be cancelled with `beforeDismiss` and modal will stay opened, but handlers will be removed. This commit introduces `closed$` event triggered inside `onDestroy` to clean up handlers. Fixes ng-bootstrap#3515
At the moment key/mouse handlers are removed when modal triggers dismiss event. The problem is that modal closure could be cancelled with `beforeDismiss` and modal will stay opened, but handlers will be removed. This commit introduces `closed$` event triggered inside `onDestroy` to clean up handlers. Fixes ng-bootstrap#3515
…3532) At the moment key/mouse handlers are removed when modal triggers dismiss event. The problem is that modal closure could be cancelled with `beforeDismiss` and modal will stay opened, but handlers will be removed. This commit introduces `closed$` event triggered inside `onDestroy` to clean up handlers. Fixes #3515
…3532) At the moment key/mouse handlers are removed when modal triggers dismiss event. The problem is that modal closure could be cancelled with `beforeDismiss` and modal will stay opened, but handlers will be removed. This commit introduces `closed$` event triggered inside `onDestroy` to clean up handlers. Fixes #3515
Bug description:
When using stacked modals to prevent dismissal of first level modal, dismissing the second level modal by keyboard/backdrop disables the keyboard/backdrop for first modal too.
Link to minimally-working StackBlitz that reproduces the issue:
https://stackblitz.com/edit/angular-dhs8oz
Versions of Angular, ng-bootstrap and Bootstrap:
Angular: 8.2.14
ng-bootstrap: 5.1.4
Bootstrap: 4.4.1
The text was updated successfully, but these errors were encountered: