Skip to content

Commit

Permalink
fix(core): submit button should not cause a reload in firefox (#611)
Browse files Browse the repository at this point in the history
  • Loading branch information
fynnfeldpausch authored Nov 28, 2024
1 parent 2717359 commit ecf2d15
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/src/components/cat-button/cat-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ export class CatButton {
event.stopImmediatePropagation();
} else if (this.submit) {
const form = findClosest('form', this.hostElement);
const event = new SubmitEvent('submit', { submitter: this.button, cancelable: true });
form?.dispatchEvent(event);
event.stopPropagation();
event.preventDefault();
if (form && form instanceof HTMLFormElement) {
// we can't provide a submitter as it is hidden in the shadow DOM
form.requestSubmit();
}
}
}

Expand Down

0 comments on commit ecf2d15

Please sign in to comment.