fix: prevent <button>'s from becoming form submit when they shouldn't#4221
Merged
fix: prevent <button>'s from becoming form submit when they shouldn't#4221
Conversation
Adds `type=button` to most `<button>` usage (except the AdminPage#submitButton). The first button of type submit (which is the default in HTML if undeclared) becomes what the enter keybind presses in a form. This makes the behavior with these components make more sense.
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.
Changes proposed in this pull request:
Adds
type=buttonto most<button>usage (except theAdminPage#submitButton). The first button of typesubmit(which is the default in HTML if undeclared) becomes what the enter keybind presses in a form. This makes the behavior with these components make more sense.I found this behavior while trying to make an extension page use a
, and enter kept opening a dropdown way down the page. Even though I could've rectified this by implementingonsubmit, the submit behavior was already declared in the button (usingAdminPage#submitButton) so there was no reason to if I could stop the dropdown from becoming the form's submit button.Reviewers should focus on:
I believe all the buttons that were missing a
typedeclaration (except the one in AdminPage, which I added just for clarity) should all be regular buttons. They can still be clicked by pressing enter when focused, but they won't override the submit button of a<form>if they're the first submit button anymore.Necessity
Confirmed
type="submit"and having the code compile should be fine.Backend changes: tests are green (runcomposer test).Required changes: