Skip to content

Commit

Permalink
Fix 'submit' redispatch in Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlbyk committed Jul 30, 2023
1 parent 89a1e13 commit 1ccc586
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
};
Expand Down

0 comments on commit 1ccc586

Please sign in to comment.