]> git.scottworley.com Git - vopamoi/commitdiff
Explicitly remove the completeEdit onblur event listener
authorScott Worley <scottworley@scottworley.com>
Thu, 27 Jan 2022 06:17:43 +0000 (22:17 -0800)
committerScott Worley <scottworley@scottworley.com>
Thu, 27 Jan 2022 20:21:55 +0000 (12:21 -0800)
When the completeEdit is invoked by keystroke, we don't want it invoked
a second time as a result of its own action removing the input field.

Firefox does *not* call the "blur" event when a focused input element is removed.
Chromium *does* call the "blur" event when a focused input element is removed.

So this is needed for Chromium.

vopamoi.ts

index 151a9e421af79eb25bc60b993bc687e6cb98c6e9..04c5d414be7a46190e4d5679991b0d1edc4cd38e 100644 (file)
@@ -199,6 +199,7 @@ const BrowserUI = {
     const task = input.parentElement!;
     const oldDescription = task.getAttribute("data-description")!;
     const newDescription = input.value;
     const task = input.parentElement!;
     const oldDescription = task.getAttribute("data-description")!;
     const newDescription = input.value;
+    input.removeEventListener("blur", BrowserUI.completeEdit);
     task.removeChild(task.children[0]);
     task.removeAttribute("data-description");
     task.focus();
     task.removeChild(task.children[0]);
     task.removeAttribute("data-description");
     task.focus();