forked from gitea/gitea
1
0
Fork 0

Make buttons in a modal form have proper type. (#25446)

Fix  #25438

All non-"ok" buttons which do not have "type" should not submit the
form, should not be triggered by "Enter".

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
wxiaoguang 2023-06-23 18:57:01 +08:00 committed by GitHub
parent 17965c8e79
commit a954c93a68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -395,6 +395,8 @@ function initGlobalShowModal() {
if (colorPickers.length > 0) { if (colorPickers.length > 0) {
initCompColorPicker(); // FIXME: this might cause duplicate init initCompColorPicker(); // FIXME: this might cause duplicate init
} }
// all non-"ok" buttons which do not have "type" should not submit the form, should not be triggered by "Enter"
$modal.find('form button:not(.ok):not([type])').attr('type', 'button');
$modal.modal('setting', { $modal.modal('setting', {
onApprove: () => { onApprove: () => {
// "form-fetch-action" can handle network errors gracefully, // "form-fetch-action" can handle network errors gracefully,