Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Buttons are submitting the form #990

Closed
1 task done
melanke opened this issue Nov 20, 2024 · 1 comment · Fixed by #992
Closed
1 task done

bug: Buttons are submitting the form #990

melanke opened this issue Nov 20, 2024 · 1 comment · Fixed by #992
Assignees

Comments

@melanke
Copy link

melanke commented Nov 20, 2024

Is there an existing issue for this?

Which method was used to setup Scaffold-ETH 2 ?

npx create-eth@latest

Current Behavior

When adding a component that contains a button (eg.: EtherInput) inside a <form>, when clicked it will submit the form.

Expected Behavior

The button should not submit the form, it should only behave how it's intended.

Steps To Reproduce

  • Create a form with onSubmit
  • Add EtherInput inside the form
  • Click on the button to swap between Ether and USD
  • It will submit the form

Anything else?

It's a very easy fix. We can simply explicitly add type="button" on all buttons and it will work just fine.
I can send a PR, if you agree this is the way to fix it. I would love to have this as my first contribution on the project.

@rin-st rin-st self-assigned this Nov 20, 2024
@rin-st rin-st mentioned this issue Nov 20, 2024
2 tasks
@rin-st
Copy link
Member

rin-st commented Nov 20, 2024

Thank you @melanke for reporting this and also for the steps to reproduce and a way to fix! I decided to fix it yourself since some components could be missed. Feel free to check the changes and review PR #992

For now it works only in the PR branch of scaffold-eth 2, but will be added to create-eth later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants