Skip to content

Commit a954c93

Browse files
wxiaoguangsilverwindGiteaBot
authored
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 <[email protected]> Co-authored-by: Giteabot <[email protected]>
1 parent 17965c8 commit a954c93

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

0 commit comments

Comments
 (0)