From b15fb36f1b546d51b3908081f1fd2e71b73739f4 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Wed, 21 Feb 2024 16:07:02 -0500 Subject: [PATCH] editable-text: Don't put 'null'/'undefined' in the field In case something deleted dataset.initialValue after focus and before we received this keypress. Addresses #3725. Might still want to rework that listener, but this change made sense regardless, since the same kind of race condition could be triggered elsewhere. --- chrome/content/zotero/elements/editableText.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/elements/editableText.js b/chrome/content/zotero/elements/editableText.js index e19b94df2b..1986cee180 100644 --- a/chrome/content/zotero/elements/editableText.js +++ b/chrome/content/zotero/elements/editableText.js @@ -239,7 +239,7 @@ } else if (event.key === 'Escape') { this.dispatchEvent(new CustomEvent('escape_enter')); - let initialValue = this._input.dataset.initialValue; + let initialValue = this._input.dataset.initialValue ?? ''; this.setAttribute('value', initialValue); this._input.value = initialValue; this._input.blur();