1
0
Fork 0

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>
This commit is contained in:
Denys Konovalov 2023-06-24 05:56:06 +02:00 committed by GitHub
parent 51789ba12d
commit 050c38ca19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -345,6 +345,8 @@ export function initGlobalButtons() {
if (colorPickers.length > 0) { if (colorPickers.length > 0) {
initCompColorPicker(); 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) { $('.delete-post.button').on('click', function (e) {