This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
OcButton: Change default type of buttons to button #2009
Merged
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.
Description
This changes the default type of
OcButton
tobutton
.The default type for
<button>
elements issubmit
. As we use it all over the place now for a11y reasons, we have lots and lots of submit buttons everywhere, which is most likely not what we want.Related Issue
Could not find an open ticket for this issue.
Motivation and Context
I recently noticed that pressing enter in one of the text inputs in the public link editing view opened the datepicker instead of saving the link:
liveview-2022-03-07_22.14.14.mp4
It was @fschade (💖 ) who pointed me towards the root of the issue:
pressing enter submits the form, which automatically clicks the first (at least in chromium) button which is not of type "button". In this case this happened to be the button that opens the datepicker.
Now I would argue that more often than not buttons should not behave as submit buttons and we should instead mark submit buttons explicitly. As there are only a few occurences of
<form
in oC Web, this change should not be too invasive...How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist:
Open tasks: