Skip to content

Commit 3426757

Browse files
committed
show form submission success messages
Fixes https://github.com/github/accessibility-audits/issues/4816
1 parent 3e70ba8 commit 3426757

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

examples/index.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<h1>auto-check-element</h1>
1414
<h2>Simple form</h2>
1515
<p>Input 422 for an error response.</p>
16+
<p id="success1" class="success" hidden>Your submission was successful</p>
1617
<form>
1718
<p>All fields marked with * are required</p>
1819

@@ -21,11 +22,12 @@ <h2>Simple form</h2>
2122
<input id="simple-field" autofocus name="foo" required />
2223
<code class="state"></code>
2324
</auto-check>
24-
<button>submit</button>
25+
<button value="1" name="form">submit</button>
2526
</form>
2627

2728
<h2>Form that has custom validity messages</h2>
2829
<p>Input 422 for an error response.</p>
30+
<p id="success2" class="success" hidden>Your submission was successful</p>
2931
<form id="custom">
3032
<p>All fields marked with * are required</p>
3133

@@ -34,11 +36,13 @@ <h2>Form that has custom validity messages</h2>
3436
<input id="custom-field" autofocus class="json" name="foo" required />
3537
<code class="state"></code>
3638
</auto-check>
37-
<button>submit</button>
39+
<button value="2" name="form">submit</button>
3840
</form>
3941
</main>
4042

4143
<script>
44+
let successN = new URL(window.location).searchParams.get('form')
45+
if (successN) document.getElementById(`success${successN}`).hidden = false
4246
let focusedInput
4347
const nativeFetch = window.fetch
4448
const fakeFetch = function (_, options) {

0 commit comments

Comments
 (0)