Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frontend: don't trigger other event handlers if delete action cancell…
…ed (#1657) Otherwise, clicking the delete button beside a custom command response and then cancelling it at the confirmation popup (erroneously) still deletes the response. An analysis of the issue: the confirmation prompt is triggered when any element with the `btn-danger` class is clicked. If confirmation fails, preventDefault() and stopPropagation() are called, which are typically sufficient to prevent the deletion from going through. But in the case where the deletion is performed in another click event handler -- which is the case for the implementation of deleting custom command responses -- stopPropagation() will (roughly speaking) only prevent event handlers on parent elements from triggering. That is, event handlers registered for the same element will still fire, hence the bug. Calling stopImmediatePropagation() will correctly stop the event handlers for the same element from triggering.
- Loading branch information