Repository navigation
fix: match browser spec for form implicit submission - #1340
Merged
snowystinger merged 3 commits intoNov 12, 2026
Merged
snowystinger merged 3 commits into
snowystinger merged 3 commits into
Conversation
snowystinger
approved these changes
Nov 12, 2026
snowystinger
left a comment
Contributor
There was a problem hiding this comment.
I added a few more tests and found some discrepancies. Given that the browsers don't all behave the same, I'm find adhering to the spec and hopefully the browsers will eventually match.
| }, | ||
| ) | ||
|
|
||
| test.each([ |
Contributor
There was a problem hiding this comment.
Found some discrepancies with these
Chrome allows submission with additional date, month, week, time, or datetime-local inputs
Safari 27.0.1 and Firefox 158 both allow submission despite an additional date, time, or datetime-local input
The difference is month and week, Safari and Firefox treat these types as ordinary text inputs, so they block submission
|
🎉 This PR is included in version 14.6.10 🎉 The release is available on: Your semantic-release bot 📦🚀 |
3 tasks done
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Pressing Enter in the only text field of a form without a submit button does not submit the form when the form also contains radio buttons, checkboxes or hidden inputs.
Why
The single-field check counts every
<input>in the form (form.querySelectorAll('input').length === 1). The HTML spec only counts fields that block implicit submission: inputs of type text, search, tel, url, email, password, date, month, week, time, datetime-local and number. Radio, checkbox, hidden, range and similar inputs do not stop implicit submission. I checked this in Chrome 152: Enter in the text field submits<form><input type=radio><input><input type=checkbox><input type=hidden></form>, but not when a<input type=number>is added.As asked in #1255, this is defined in the spec.
How
Count only the inputs whose type is in the spec's list of blocking fields.
Two cases were added to the
submit form on [Enter]table intests/event/behavior/keypress.ts. Onmainthe new radio/checkbox/hidden case fails withExpected: true, Received: falseon thesubmitassertion. With the change, the full jest suite (522 tests), lint and typecheck pass, and the toolbox run passes the keypress tests in both Node environments.Fixes #1255
Checklist