davidtheclark / react-aria-modal

A fully accessible React modal built according WAI-ARIA Authoring Practices

Home Page:http://davidtheclark.github.io/react-aria-modal/demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Modal getting closed when user tries to scroll the modal

nahme2 opened this issue · comments

When I am trying to scroll the modal the modal gets closed immediately. After debugging the code I found that the script which actually closes the modal in general scenarios.
checkUnderlayClick = event => {
if (this.dialogNode && this.dialogNode.contains(event.target)) return;
this.exit();
};
Here the main problem is clicking on scrollbar is same as clicking outside the modal content or backdrop area.
Actually the code should be changed as follow to solve the issue
checkUnderlayClick = event => {
if (this.dialogNode && this.dialogNode.contains(event.target) || event .pageX > event.target.clientWidth || event.pageY > event.target.clientHeight) return;
this.exit();
};
This basically test if we are clicking outside the target that includes scrollbar.

Have opened a PR for the above issue please review and comment on that.
#75

Closed by #75.