Skip to content

Commit

Permalink
Check for panel before hiding
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici authored and Çağatay Çivici committed Aug 25, 2018
1 parent fe7d162 commit 7d55875
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/components/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ export class Calendar extends Component {
}

componentWillUnmount() {
if (this.hideTimeout) {
clearTimeout(this.hideTimeout);
}
if (this.mask) {
this.disableModality();
this.mask = null;
Expand Down Expand Up @@ -685,15 +688,17 @@ export class Calendar extends Component {
}

hideOverlay() {
DomHandler.addClass(this.panel, 'p-input-overlay-hidden');
DomHandler.removeClass(this.panel, 'p-input-overlay-visible');
this.unbindDocumentClickListener();
this.datepickerClick = false;

setTimeout(() => {
this.panel.style.display = 'none';
DomHandler.removeClass(this.panel, 'p-input-overlay-hidden');
}, 150);
if (this.panel) {
DomHandler.addClass(this.panel, 'p-input-overlay-hidden');
DomHandler.removeClass(this.panel, 'p-input-overlay-visible');
this.unbindDocumentClickListener();
this.datepickerClick = false;

this.hideTimeout = setTimeout(() => {
this.panel.style.display = 'none';
DomHandler.removeClass(this.panel, 'p-input-overlay-hidden');
}, 150);
}
}

bindDocumentClickListener() {
Expand Down

0 comments on commit 7d55875

Please sign in to comment.