From efd7ec6dc24ea6284c529920264add521939dad3 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Thu, 22 Feb 2024 09:50:08 -0500 Subject: [PATCH] Fix title/abstract saving when window becomes inactive We weren't stopping 'change' from propagating upwards when the change hadn't actually been committed yet, and the pane-header and abstract-box CEs listen to that event instead of 'blur'. --- chrome/content/zotero/elements/editableText.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/elements/editableText.js b/chrome/content/zotero/elements/editableText.js index 1986cee180..af80a93c85 100644 --- a/chrome/content/zotero/elements/editableText.js +++ b/chrome/content/zotero/elements/editableText.js @@ -190,7 +190,8 @@ } this.setAttribute('value', this._input.value); }; - let handleChange = () => { + let handleChange = (event) => { + event.stopPropagation(); this.setAttribute('value', this._input.value); }; input.addEventListener('mousedown', () => { @@ -222,7 +223,10 @@ } this._ignoredWindowInactiveBlur = false; - this.dispatchEvent(new CustomEvent('blur')); + this.dispatchEvent(new Event('blur')); + if (this.value !== this._input.dataset.initialValue) { + this.dispatchEvent(new Event('change')); + } this.classList.remove("focused"); this._input.scrollLeft = 0; this._input.setSelectionRange(0, 0);