Skip to content

Commit 050c38c

Browse files
denyskonwxiaoguang
andauthored
Make buttons in a modal form have proper type. (go-gitea#25446) (go-gitea#25478)
Backport go-gitea#25446 by @wxiaoguang 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: wxiaoguang <[email protected]>
1 parent 51789ba commit 050c38c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

web_src/js/features/common-global.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,8 @@ export function initGlobalButtons() {
345345
if (colorPickers.length > 0) {
346346
initCompColorPicker();
347347
}
348+
// all non-"ok" buttons which do not have "type" should not submit the form, should not be triggered by "Enter"
349+
$($(this).attr('data-modal')).find('form button:not(.ok):not([type])').attr('type', 'button');
348350
});
349351

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

0 commit comments

Comments
 (0)