Try hosting the button <form>
inside a <div>
element rahter than a <span>
element.
Form is a block level element. A span is an inline element. You can't have block elements inside inline ones. Depending on the browser, you may get different behavior when clicking on the button.