Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
fix(modal-backdrop): On modal close, screen is stuck
Browse files Browse the repository at this point in the history
If we open the stack report modal on click of a card in the Analytics widget in the space dashboard and then close it, the page stuck and prevents a user to click on the screen
  • Loading branch information
jyasveer authored and Jyasveer Gotta committed Apr 25, 2018
1 parent b0ec991 commit cdef3ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ dist-watch/
# NPM #

npm-debug.log*

.history
16 changes: 10 additions & 6 deletions src/app/stack/stack-details/stack-details.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, Input, OnChanges, ViewChild, ViewEncapsulation, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Modal } from 'ngx-modal';

import { StackAnalysesService } from '../stack-analyses.service';
import { getStackReportModel } from '../utils/stack-api-utils';
Expand Down Expand Up @@ -39,7 +40,7 @@ export class StackDetailsComponent implements OnChanges, OnInit {
@Input() showFlags;
@Input() openStackModalFromCard: string;

@ViewChild('stackModule') modalStackModule: any;
@ViewChild('stackModule') modalStackModule: Modal;


/**
Expand Down Expand Up @@ -107,6 +108,7 @@ export class StackDetailsComponent implements OnChanges, OnInit {
*/
public handleModalClose(): void {
this.resetFields();
SaveState.isModalOpened = false;
}


Expand Down Expand Up @@ -202,10 +204,13 @@ export class StackDetailsComponent implements OnChanges, OnInit {
}

ngOnInit() {
this.commonService.inshortCardClicked
.subscribe(response => {
this.showStackModal(null);
});
if (SaveState.isModalOpened === false) {
SaveState.isModalOpened = true;
this.commonService.inshortCardClicked
.subscribe(response => {
this.showStackModal(null);
});
}
}

public handleChangeFilter(filterBy: any): void {
Expand Down Expand Up @@ -264,7 +269,6 @@ export class StackDetailsComponent implements OnChanges, OnInit {
this.cacheResponse = {};
SaveState.ELEMENTS = [];
this.openStackModalFromCard = 'false';
// this.dataLoaded = false;
}

private handleResponse(data: any): void {
Expand Down
1 change: 1 addition & 0 deletions src/app/stack/utils/SaveState.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export class SaveState {
public static ELEMENTS: Array<HTMLElement> = [];
public static isModalOpened = false;
}

0 comments on commit cdef3ef

Please sign in to comment.