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.
This commit is contained in:
Abe Jellinek 2024-02-21 16:07:02 -05:00
parent 07296b4506
commit b15fb36f1b

View file

@ -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();