The `keypress` event does not fire while making changes to some parts of the value. This becomes an issue when the dialog is submitted through the enter key without a blur happening.
See https://www.woltlab.com/community/thread/296596-farbw%C3%A4hler-durch-enter-speichert-den-wert-nicht/
this.colorTextInput = content.querySelector("input[type=text]") as HTMLInputElement;
this.colorTextInput.addEventListener("blur", (ev) => this.updateColorFromHex(ev));
- this.colorTextInput.addEventListener("keypress", (ev) => this.updateColorFromHex(ev));
+ this.colorTextInput.addEventListener("input", (ev) => this.updateColorFromHex(ev));
if (ColorUtil.isValidColor(this.input.value)) {
this.setInitialColor(this.input.value);
this.oldColor = content.querySelector(".colorPickerColorOld > span");
this.colorTextInput = content.querySelector("input[type=text]");
this.colorTextInput.addEventListener("blur", (ev) => this.updateColorFromHex(ev));
- this.colorTextInput.addEventListener("keypress", (ev) => this.updateColorFromHex(ev));
+ this.colorTextInput.addEventListener("input", (ev) => this.updateColorFromHex(ev));
if (ColorUtil.isValidColor(this.input.value)) {
this.setInitialColor(this.input.value);
}