Skip to content

Commit cd0fbd0

Browse files
committed
fix: ignore click in visible modal in case of pop up meny
1 parent b365a5a commit cd0fbd0

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/Common/Modals/Modal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import React, { useEffect } from 'react'
1818
import ReactDOM from 'react-dom'
1919
import { ModalType } from '../Types'
20+
import { POP_UP_MENU_MODAL_ID } from '@Shared/constants'
2021

2122
/**
2223
* @deprecated Use VisibleModal instead
@@ -78,7 +79,7 @@ export const Modal = ({
7879
innerRef.current = el
7980
}}
8081
id="popup"
81-
className={`${rootClassName} popup ${modal ? 'modal' : ''}`}
82+
className={`${rootClassName} ${POP_UP_MENU_MODAL_ID} ${modal ? 'modal' : ''}`}
8283
style={{ ...style }}
8384
>
8485
{children}

src/Common/Modals/VisibleModal.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import React, { SyntheticEvent } from 'react'
1818
import ReactDOM from 'react-dom'
19-
import { preventBodyScroll } from '../../Shared'
19+
import { POP_UP_MENU_MODAL_ID, preventBodyScroll } from '../../Shared'
2020
import { stopPropagation } from '../Helper'
2121

2222
export class VisibleModal extends React.Component<{
@@ -67,6 +67,10 @@ export class VisibleModal extends React.Component<{
6767
}
6868

6969
handleBodyClick = (e: SyntheticEvent) => {
70+
const isPopupMenuPresent = document.getElementById(POP_UP_MENU_MODAL_ID)
71+
if (isPopupMenuPresent) {
72+
return
73+
}
7074
e.stopPropagation()
7175

7276
this.props.close?.(e)

src/Shared/constants.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,3 +419,5 @@ export enum ComponentSizeType {
419419
medium = 'medium',
420420
large = 'large',
421421
}
422+
423+
export const POP_UP_MENU_MODAL_ID = 'popup'

0 commit comments

Comments
 (0)