Skip to content

Commit

Permalink
Fixed attempt to call .some() on DomTokenList, which isn't an array
Browse files Browse the repository at this point in the history
  • Loading branch information
hsource committed Mar 20, 2020
1 parent b5e1155 commit 0a480d4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,12 @@ class Modal extends Component<Props, State> {
if (allowClose) this.handleClose(event);
};
handleBackdropClick = (event: MouseEvent) => {
const hasBackdropClassName = event.target.classList.some(className =>
backdropClassNames.has(className),
);
let hasBackdropClassName = false;
for (const targetClass of event.target.classList) {
if (backdropClassNames.has(targetClass)) {
hasBackdropClassName = true;
}
}

if (!hasBackdropClassName || !this.props.closeOnBackdropClick) {
return;
Expand Down

0 comments on commit 0a480d4

Please sign in to comment.