FIX: prevent event bubbling when closing modals with escape key (#22928)

This change prevents event bubbling for the Escape key on all modals. Currently when we close the modal using the Escape key, all other event listeners attached will also be triggered (such as closing the chat drawer if it's open).
This commit is contained in:
David Battersby 2023-08-02 17:15:08 +08:00 committed by GitHub
parent 5ae0220638
commit 906bfdebea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,6 +86,7 @@ export default class DModal extends Component {
}
if (event.key === "Escape" && this.dismissable) {
event.stopPropagation();
this.args.closeModal({ initiatedBy: CLOSE_INITIATED_BY_ESC });
}