From 06c1c0451230f08966b63fc174160ff8a20cf4f2 Mon Sep 17 00:00:00 2001 From: Zain Gulbaz Date: Sun, 28 Aug 2022 07:54:07 +0500 Subject: [PATCH] [Added] close modal on right click --- src/components/ModalPortal.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/ModalPortal.js b/src/components/ModalPortal.js index bbc440ed..063b5e21 100644 --- a/src/components/ModalPortal.js +++ b/src/components/ModalPortal.js @@ -300,13 +300,12 @@ export default class ModalPortal extends Component { this.shouldClose = null; }; - handleOverlayRightClick = (event) => { - if (this.shouldClose === null) this.shouldClose = true; - else if (!this.shouldClose) this.shouldClose = null; - if (this.shouldClose) { - event.preventDefault(); - this.props.onOverlayRightClick(event); - } + handleOverlayRightClick = event => { + if(event.target == this.overlay) + { + event.preventDefault(); + this.props.onOverlayRightClick(event); + } }; handleContentOnMouseUp = () => {