summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/fresh-games-confess.md5
-rw-r--r--packages/astro/components/ViewTransitions.astro2
2 files changed, 6 insertions, 1 deletions
diff --git a/.changeset/fresh-games-confess.md b/.changeset/fresh-games-confess.md
new file mode 100644
index 000000000..fa6a0fe97
--- /dev/null
+++ b/.changeset/fresh-games-confess.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Fixes View Transition's form submission prevention, allowing `preventDefault` to be used.
diff --git a/packages/astro/components/ViewTransitions.astro b/packages/astro/components/ViewTransitions.astro
index 310f1865a..e8e12ce3d 100644
--- a/packages/astro/components/ViewTransitions.astro
+++ b/packages/astro/components/ViewTransitions.astro
@@ -94,7 +94,7 @@ const { fallback = 'animate' } = Astro.props;
document.addEventListener('submit', (ev) => {
let el = ev.target as HTMLElement;
- if (el.tagName !== 'FORM' || isReloadEl(el)) {
+ if (el.tagName !== 'FORM' || ev.defaultPrevented || isReloadEl(el)) {
return;
}
const form = el as HTMLFormElement;