Skip to content

Explicitly set type="submit" on form buttons#11726

Open
ISenseAura wants to merge 1 commit intosmogon:masterfrom
ISenseAura:preactfixesv1
Open

Explicitly set type="submit" on form buttons#11726
ISenseAura wants to merge 1 commit intosmogon:masterfrom
ISenseAura:preactfixesv1

Conversation

@ISenseAura
Copy link
Member

@ISenseAura ISenseAura commented Jan 29, 2026

this fixes an issue on the preact client where the “Add player” button in multi battles was treated as a regular button instead of a submit button, preventing the form submission and blocking the functionality.

Couldnt figure out the cause of the issue on client side, heres a chatgpt-summary of what i tried to debug.

What we tried / checked
We first assumed something was blocking submit, so we checked for preventDefault() everywhere. We added global click and submit listeners, monkey-patched preventDefault(), used DevTools event breakpoints, and verified no JS was cancelling anything. Nothing logged. That ruled out JavaScript interference completely.

Next, we suspected DOM mutation or re-rendering. We used MutationObserver, checked whether the button node was being replaced, tracked identity with custom properties, and compared attributes vs properties. The node stayed the same, and no mutations were observed, so it wasn’t Caja, Preact, or a re-render changing the button.

Then we focused on button semantics. We verified the button’s type, checked hasAttribute('type'), and observed how DevTools showed type="button" after interaction. This turned out to be misleading UI reflection, not an actual mutation.

Finally, we tested the form directly using:

form.requestSubmit();

This worked immediately and reliably. That proved the form was valid, the submit handler worked, and the browser could create a submit event.

What that told us

The submit event was never being created from the button click. Nothing was blocking it; the browser simply didn’t consider the click a submit action. Explicitly forcing submission (requestSubmit() or temporarily adding type="submit") worked, but implicit submit behavior did not survive in this app’s interaction model.

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 this pull request may close these issues.

1 participant