Skip to content

Commit

Permalink
fix for issue valor-software#5893
Browse files Browse the repository at this point in the history
  • Loading branch information
woricek committed Aug 6, 2020
1 parent 6a5df49 commit 87e7df8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/modal/modal-container.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class ModalContainerComponent implements OnInit, OnDestroy {
bsModalService: BsModalService;
private isModalHiding = false;
private clickStartedInContent = false;
private clickStartedInScrollBar = false;

constructor(options: ModalOptions,
protected _element: ElementRef,
Expand Down Expand Up @@ -82,17 +83,19 @@ export class ModalContainerComponent implements OnInit, OnDestroy {
@HostListener('mousedown', ['$event'])
onClickStarted(event: MouseEvent): void {
this.clickStartedInContent = event.target !== this._element.nativeElement;
this.clickStartedInScrollBar = event.clientX > this._element.nativeElement.clientWidth;
}

@HostListener('mouseup', ['$event'])
onClickStop(event: MouseEvent): void {
const clickedInBackdrop = event.target === this._element.nativeElement && !this.clickStartedInContent;
const clickedInBackdrop = event.target === this._element.nativeElement && !this.clickStartedInContent && !this.clickStartedInScrollBar;
if (
this.config.ignoreBackdropClick ||
this.config.backdrop === 'static' ||
!clickedInBackdrop
) {
this.clickStartedInContent = false;
this.clickStartedInScrollBar = false;

return;
}
Expand Down

0 comments on commit 87e7df8

Please sign in to comment.