From 167e50b7af8b3595569b668173bfee5c5c6f782a Mon Sep 17 00:00:00 2001 From: cballevre Date: Fri, 9 Feb 2024 10:21:30 +0100 Subject: [PATCH] fix: Stop propagation of event This avoids triggering events for elements below the component, for example in Banks there are chips integrated into ListItems --- react/IntentDialogOpener/IntentDialogOpener.jsx | 1 + react/deprecated/IntentModal/IntentModal.jsx | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/react/IntentDialogOpener/IntentDialogOpener.jsx b/react/IntentDialogOpener/IntentDialogOpener.jsx index 8514f3f8b8..fbf820c37b 100644 --- a/react/IntentDialogOpener/IntentDialogOpener.jsx +++ b/react/IntentDialogOpener/IntentDialogOpener.jsx @@ -28,6 +28,7 @@ const IntentDialogOpener = props => { const openModal = ev => { ev.preventDefault() + ev.stopPropagation() setModalOpened(true) } const closeModal = () => setModalOpened(false) diff --git a/react/deprecated/IntentModal/IntentModal.jsx b/react/deprecated/IntentModal/IntentModal.jsx index e3d920737b..e3311b7311 100644 --- a/react/deprecated/IntentModal/IntentModal.jsx +++ b/react/deprecated/IntentModal/IntentModal.jsx @@ -46,9 +46,9 @@ class IntentModal extends Component { // FIXME: this should be fixed by diferenciating dismissAction (for closing // modal) and onCancel (for intent cancellation), but it implies deprecating // dismissAction first, ensure legacy, prevent regressions, etc. - dismiss = once(() => { + dismiss = once(evt => { const { dismissAction } = this.props - dismissAction && dismissAction() + dismissAction && dismissAction(evt) }) render() {