mapbox / mapbox/react-submittable
Button's in forms cause double submits onEnter
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 18
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Because a button's default type is submit and a form will trigger a submit on enter, giving a button inside of <Submittable> an onSubmit callback that is the same as a the required onEnter callback will cause double submit.
This can be prevented by invoking event.preventDefault() inside of the callback, but we might want to look at preventing inside of react-submittable as this seems unexpected.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting react-submittable's form and button handling, then reproduce the case where a button's onSubmit callback matches the required onEnter callback and pressing Enter submits twice. Done means the component prevents the duplicate submit without requiring callers to invoke event.preventDefault() themselves.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100