For me, the answer was I don't want the button to send the form at all, and this helped me:
https://stackoverflow.com/a/3315016/5057078
Text of the answer:
The default value for the type
attribute of button
elements is "submit". Set it to type="button"
to produce a button that doesn't submit the form.
<button type="button">Submit</button>
In the words of the HTML Standard: "Does nothing."