Make sure a close event doesn't close more than one dialog

This commit is contained in:
trading_peter 2025-02-06 22:32:15 +01:00
parent b725bceb4f
commit 89a8f893c2
2 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@tp/tp-dialog", "name": "@tp/tp-dialog",
"version": "1.2.0", "version": "1.2.1",
"description": "", "description": "",
"main": "tp-dialog.js", "main": "tp-dialog.js",
"scripts": { "scripts": {

View File

@ -123,7 +123,12 @@ class TpDialog extends EventHelpers(LitElement) {
} }
} }
close() { close(e) {
if (e) {
e.stopPropagation();
e.preventDefault();
}
this.dialog.close(); this.dialog.close();
this.dispatchEvent(new CustomEvent('closed', { detail: null, bubbles: true, composed: true })); this.dispatchEvent(new CustomEvent('closed', { detail: null, bubbles: true, composed: true }));
this.open = false; this.open = false;