Skip to content

Commit

Permalink
Merge pull request #647 from janibolkvadze/FSPE-5309-Fix-Drawer-X-but…
Browse files Browse the repository at this point in the history
…ton-close-behavior

[FSPE-5309] Fixed Drawer X button close behavior
  • Loading branch information
jllr committed Jun 19, 2020
2 parents f574b96 + 1ac093a commit 36502aa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/custom-elements/src/components/drawer/drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,17 @@ export class Drawer {

private _documentClickHandler = (ev): void => {
const drawerElement = this.el.querySelector('.chi-drawer');
const drawerCloseButton = this.nonClosable ? null : drawerElement.querySelector('button.-close');
const clickTarget = ev.target as HTMLElement;

if (!this.preventAutoHide) {
if (drawerElement.classList.contains('-active')) {
this.active = contains(drawerElement, ev.target as HTMLInputElement);
const clickOnCloseButton = drawerCloseButton &&
clickTarget === drawerCloseButton ||
contains(drawerCloseButton, clickTarget);

this.active = contains(drawerElement, clickTarget) &&
!clickOnCloseButton;
}
}
};
Expand Down

0 comments on commit 36502aa

Please sign in to comment.