Hi, may I know is it possible to add a check on the event target for the OverlayMask component to prevent onClick getting triggered by the bubbling up of the child element's click event?
The use case is that I was trying to allow both the EuiOverlayMask and EuiModal's close button to close the modal. However, when I tried to submit the modal form, the EuiOverlayMask's onClick got triggered by the bubbling of the click event from the modal submit button.
|
if (onClick) { |
|
this.overlayMaskNode.addEventListener('click', onClick); |
|
} |
Suggestion:
if (onClick) {
this.overlayMaskNode.addEventListener('click', (e) => {
if (this == e.target) {
onClick();
}
});
}
Hi, may I know is it possible to add a check on the event target for the
OverlayMaskcomponent to preventonClickgetting triggered by the bubbling up of the child element's click event?The use case is that I was trying to allow both the
EuiOverlayMaskandEuiModal's close button to close the modal. However, when I tried to submit the modal form, theEuiOverlayMask'sonClickgot triggered by the bubbling of the click event from the modal submit button.eui/src/components/overlay_mask/overlay_mask.tsx
Lines 52 to 54 in 84bbe8d
Suggestion: