From 1ccc586000b6a0f45bba0baccf54dbe17f4acd98 Mon Sep 17 00:00:00 2001 From: Keith Dahlby Date: Sun, 30 Jul 2023 15:32:51 -0500 Subject: [PATCH] Fix 'submit' redispatch in Firefox --- src/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index b50ede4..bc9737f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -859,10 +859,16 @@ export class ValidationService { }); form.dispatchEvent(validationEvent); - this.handleValidated(form, success, e); + // Firefox fix: redispatch 'submit' after finished handling this event + setTimeout(() => { + try { + this.handleValidated(form, success, e); + } finally { + validating = false; + } + }, 0); }).catch(error => { this.logger.log('Validation error', error); - }).finally(() => { validating = false; }); };