Skip to content

Commit f6714f6

Browse files
martrappflorian-lefebvre
andauthoredDec 20, 2023
view transition's form handling honors default prevention (#9486)
* add missing check to honor prevented default * added changeset * Update .changeset/fresh-games-confess.md Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> --------- Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
1 parent 5062d27 commit f6714f6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

‎.changeset/fresh-games-confess.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Fixes View Transition's form submission prevention, allowing `preventDefault` to be used.

‎packages/astro/components/ViewTransitions.astro

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const { fallback = 'animate' } = Astro.props;
9494

9595
document.addEventListener('submit', (ev) => {
9696
let el = ev.target as HTMLElement;
97-
if (el.tagName !== 'FORM' || isReloadEl(el)) {
97+
if (el.tagName !== 'FORM' || ev.defaultPrevented || isReloadEl(el)) {
9898
return;
9999
}
100100
const form = el as HTMLFormElement;

0 commit comments

Comments
 (0)
Please sign in to comment.