Skip to content

Commit

Permalink
Make buttons in a modal form have proper type. (go-gitea#25446)
Browse files Browse the repository at this point in the history
Fix  go-gitea#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 <[email protected]>
Co-authored-by: Giteabot <[email protected]>
  • Loading branch information
3 people authored and denyskon committed Jun 23, 2023
1 parent b0de3d0 commit 366f86b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions web_src/js/features/common-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ export function initGlobalButtons() {
if (colorPickers.length > 0) {
initCompColorPicker();
}
// all non-"ok" buttons which do not have "type" should not submit the form, should not be triggered by "Enter"
$($(this).attr('data-modal')).find('form button:not(.ok):not([type])').attr('type', 'button');
});

$('.delete-post.button').on('click', function (e) {
Expand Down

0 comments on commit 366f86b

Please sign in to comment.