Repository navigation
fix: do not implicitly submit month and week inputs - #1355
snowystinger merged 2 commits into
Conversation
These controls do not participate in single-input implicit submission. Keep them blocking when other fields are present and add regressions for both input types.
snowystinger
left a comment
There was a problem hiding this comment.
Ok, so I went down a rabbit hole with this one.
According to the spec, Chrome is in the wrong
If the form has more than one field that blocks implicit submission, then return.
They should submit if they are the only field in the form.
However, I found this issue https://issues.chromium.org/issues/40218227
Which points to this spec issue whatwg/html#7730
and has an approved PR from 2022 whatwg/html#7731 which I've bumped
The summary is that not only should the fields be able to implicitly submit if they are alone, but they should also not block submission for others.
We'll see if the bump over there stirs anything, otherwise I'm inclined to match the browser so that it's accurate to real life and therefor useful. Then we can update whenever the spec is updated and the browsers implement it.
One other thing is that Chrome currently does do the right thing and does not block implicit submission if there is a month input in the form
https://jsfiddle.net/cvhwbdkp/2/
So I think we'll want to remove them from the BlockImplicitSubmission
|
Thanks for digging into this — that's really helpful context. I've updated the PR to match the browser behavior you described in 9cfe814:
Full |
snowystinger
left a comment
There was a problem hiding this comment.
thanks for updating
|
🎉 This PR is included in version 14.6.14 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Problem
Pressing Enter in a form containing only a
monthorweekinput triggers implicit submission in user-event, unlike browser behavior for these controls.Root cause
SubmitSingleInputOnEnterincludedmonthandweek. They belong inBlockImplicitSubmission, where they already remain present, but not in the single-input allowlist.Solution
Remove only
monthandweekfromSubmitSingleInputOnEnterand add regressions asserting that Enter produces neither submission nor a synthetic click.Testing
npm test -- --runInBand tests/event/behavior/keypress.ts— 51/51 tests passed, independently rerun.npm run validate -spassed.Fixes #1348