Skip to content

Commit

Permalink
fix(modal): change to add Dismiss Reason on modal hide with back click (
Browse files Browse the repository at this point in the history
#5942)

* fix(modal): change to add Dismiss Reason on modal hide with back navigation
change to show Dismiss Reason on modal hide

* Removed unwanted changes

* fix(modal): fix lint issue

Co-authored-by: Ankit Mishra <ankitmishra@Ankit-MacBook-Pro.local>
Co-authored-by: Dmitry Danilov <daniloff200@gmail.com>
  • Loading branch information
3 people committed Oct 1, 2020
1 parent 9583752 commit bf25a11
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/modal/modal-container.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export class ModalContainerComponent implements OnInit, OnDestroy {
@HostListener('window:popstate')
onPopState(): void {
this.hide();
this.bsModalService.setDismissReason(DISMISS_REASONS.BACK);

This comment has been minimized.

Copy link
@leo6104

leo6104 Oct 1, 2020

Contributor

I think it should be call before this.hide();
@cankitm Can you change the order?

    this.bsModalService.setDismissReason(DISMISS_REASONS.BACK);
    this.hide();

In other cases (onEsc, onClickStop), call setDismissReason before hide.

It can be a problem in the future.

}

@HostListener('window:keydown.esc', ['$event'])
Expand Down
3 changes: 2 additions & 1 deletion src/modal/modal-options.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,6 @@ export const TRANSITION_DURATIONS: TransitionDurations = {

export const DISMISS_REASONS: DismissReasons = {
BACKRDOP: 'backdrop-click',
ESC: 'esc'
ESC: 'esc',
BACK: 'broswer-back-navigation-clicked'
};
1 change: 1 addition & 0 deletions src/modal/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ export interface TransitionDurations {
export interface DismissReasons {
BACKRDOP: string;
ESC: string;
BACK: string;
}

0 comments on commit bf25a11

Please sign in to comment.