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.
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.