Skip to content

Commit

Permalink
fix: Stop propagation of event
Browse files Browse the repository at this point in the history
This avoids triggering events for elements below the component, for example in Banks there are chips integrated into ListItems
  • Loading branch information
cballevre committed Feb 9, 2024
1 parent 50e0248 commit 167e50b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions react/IntentDialogOpener/IntentDialogOpener.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const IntentDialogOpener = props => {

const openModal = ev => {
ev.preventDefault()
ev.stopPropagation()
setModalOpened(true)
}
const closeModal = () => setModalOpened(false)
Expand Down
4 changes: 2 additions & 2 deletions react/deprecated/IntentModal/IntentModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 167e50b

Please sign in to comment.