Explicitly set type="submit" on form buttons#11726
Open
ISenseAura wants to merge 1 commit intosmogon:masterfrom
Open
Explicitly set type="submit" on form buttons#11726ISenseAura wants to merge 1 commit intosmogon:masterfrom
ISenseAura wants to merge 1 commit intosmogon:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.