fix: Prevent submitting invalid regex with keyboard enter (#2228)

Fixes https://github.com/webrecorder/browsertrix/issues/2227
This commit is contained in:
sua yoo 2024-12-10 00:00:09 -08:00 committed by GitHub
parent b7604ee61d
commit 541298eb48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -178,7 +178,7 @@ export class QueueExclusionForm extends LiteElement {
private readonly onKeyDown = (e: KeyboardEvent) => {
e.stopPropagation();
if (e.key === "Enter") {
if (e.key === "Enter" && !this.isRegexInvalid) {
void this.handleAdd();
}
};
@ -217,7 +217,7 @@ export class QueueExclusionForm extends LiteElement {
private async handleAdd() {
this.onInput.flush();
await this.updateComplete;
if (!this.regex) return;
if (!this.regex || this.isRegexInvalid) return;
if (this.input) {
this.input.value = "";