-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect forms with enctype set for view transitions (#9466)
* Respect forms with enctype set for view transitions * Add changeset * Revert "Respect forms with enctype set for view transitions" This reverts commit 6d3e04a. * Review feedback * Handle submitter case * Move comment * Update .changeset/rude-geckos-rush.md * Add tests --------- Co-authored-by: Nate Moore <[email protected]>
- Loading branch information
1 parent
1f3d72b
commit 5062d27
Showing
4 changed files
with
107 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Updates view transitions `form` handling with logic for the [`enctype`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/enctype) attribute |
10 changes: 6 additions & 4 deletions
10
packages/astro/e2e/fixtures/view-transitions/src/pages/form-one.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
--- | ||
import Layout from '../components/Layout.astro'; | ||
const method = Astro.url.searchParams.get('method') ?? 'POST'; | ||
const enctype = Astro.url.searchParams.get('enctype'); | ||
const postShowThrow = Astro.url.searchParams.has('throw') ?? false; | ||
--- | ||
|
||
<Layout> | ||
<h2>Contact Form</h2> | ||
<form action="/contact" method={method}> | ||
<input type="hidden" name="name" value="Testing"> | ||
{postShowThrow ? <input type="hidden" name="throw" value="true"> : ''} | ||
<input type="submit" value="Submit" id="submit"> | ||
<form action="/contact" method={method} {...enctype ? { enctype } : {}}> | ||
<input type="hidden" name="name" value="Testing" /> | ||
{postShowThrow ? <input type="hidden" name="throw" value="true" /> : ''} | ||
<input type="submit" value="Submit" id="submit" /> | ||
</form> | ||
</Layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters