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 d4c38f4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ export class ValidationService {
validating = true;
this.logger.log('Validating', form);

validate.then(success => {
validate.then(async success => {
this.logger.log('Validated (success = %s)', success, form);
if (callback) {
callback(success);
Expand All @@ -859,6 +859,8 @@ export class ValidationService {
});
form.dispatchEvent(validationEvent);

// Firefox fix: redispatch 'submit' after finished handling this event
await new Promise(resolve => { setTimeout(resolve, 0); });
this.handleValidated(form, success, e);
}).catch(error => {
this.logger.log('Validation error', error);
Expand Down

0 comments on commit d4c38f4

Please sign in to comment.