aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Konovalov <kontakt@denyskon.de>2023-06-24 05:56:06 +0200
committerGitHub <noreply@github.com>2023-06-24 11:56:06 +0800
commit050c38ca19cce06040741321e7871121981c76f4 (patch)
treeefa94ac4674e1f86d22dfd9610e7743a539862bd
parent51789ba12d0585ebf5d52a550cb979067b2f0c2b (diff)
downloadgitea-050c38ca19cce06040741321e7871121981c76f4.tar.gz
gitea-050c38ca19cce06040741321e7871121981c76f4.zip
Make buttons in a modal form have proper type. (#25446) (#25478)
Backport #25446 by @wxiaoguang 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: wxiaoguang <wxiaoguang@gmail.com>
-rw-r--r--web_src/js/features/common-global.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js
index 46a80beb51..e6421b3a2f 100644
--- a/web_src/js/features/common-global.js
+++ b/web_src/js/features/common-global.js
@@ -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) {