scaffold-eth / scaffold-eth-2

Open source forkable Ethereum dev stack
https://scaffoldeth.io
MIT License
1.42k stars 894 forks source link

bug: Buttons are submitting the form #990

Closed melanke closed 6 days ago

melanke commented 1 week ago

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

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 commented 1 week ago

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 https://github.com/scaffold-eth/scaffold-eth-2/pull/992

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