Skip to content

Commit 06c1c04

Browse files
committed
[Added] close modal on right click
1 parent a16949b commit 06c1c04

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/components/ModalPortal.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,12 @@ export default class ModalPortal extends Component {
300300
this.shouldClose = null;
301301
};
302302

303-
handleOverlayRightClick = (event) => {
304-
if (this.shouldClose === null) this.shouldClose = true;
305-
else if (!this.shouldClose) this.shouldClose = null;
306-
if (this.shouldClose) {
307-
event.preventDefault();
308-
this.props.onOverlayRightClick(event);
309-
}
303+
handleOverlayRightClick = event => {
304+
if(event.target == this.overlay)
305+
{
306+
event.preventDefault();
307+
this.props.onOverlayRightClick(event);
308+
}
310309
};
311310

312311
handleContentOnMouseUp = () => {

0 commit comments

Comments
 (0)