summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-06-23 18:57:01 +0800
committerGitHub <noreply@github.com>2023-06-23 12:57:01 +0200
commita954c93a68072042aa7dad717b6fa002c83a58fb (patch)
tree368a61514d4b785c62aca4e0f8391646579b6c83
parent17965c8e79c979d873291036234beb6d834a45be (diff)
downloadgitea-a954c93a68072042aa7dad717b6fa002c83a58fb.tar.gz
gitea-a954c93a68072042aa7dad717b6fa002c83a58fb.zip
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>
-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 e5fd7c29fc..8bbf202eff 100644
--- a/web_src/js/features/common-global.js
+++ b/web_src/js/features/common-global.js
@@ -395,6 +395,8 @@ function initGlobalShowModal() {
if (colorPickers.length > 0) {
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', {
onApprove: () => {
// "form-fetch-action" can handle network errors gracefully,