fix(grid): Add type attribute to buttons (#25021)

This commit is contained in:
Corentin Flr 2024-02-22 13:37:26 +01:00 committed by GitHub
parent 1ff7b84140
commit 8deed2e519
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -85,29 +85,29 @@ export default class Grid {
<div class="small form-clickable-section grid-footer">
<div class="flex justify-between">
<div class="grid-buttons">
<button class="btn btn-xs btn-danger grid-remove-rows hidden"
<button type="button" class="btn btn-xs btn-danger grid-remove-rows hidden"
data-action="delete_rows">
${__("Delete")}
</button>
<button class="btn btn-xs btn-danger grid-remove-all-rows hidden"
<button type="button" class="btn btn-xs btn-danger grid-remove-all-rows hidden"
data-action="delete_all_rows">
${__("Delete All")}
</button>
<!-- hack to allow firefox include this in tabs -->
<button class="btn btn-xs btn-secondary grid-add-row">
<button type="button" class="btn btn-xs btn-secondary grid-add-row">
${__("Add Row")}
</button>
<button class="grid-add-multiple-rows btn btn-xs btn-secondary hidden">
<button type="button" class="grid-add-multiple-rows btn btn-xs btn-secondary hidden">
${__("Add Multiple")}</a>
</button>
</div>
<div class="grid-pagination">
</div>
<div class="grid-bulk-actions text-right">
<button class="grid-download btn btn-xs btn-secondary hidden">
<button type="button" class="grid-download btn btn-xs btn-secondary hidden">
${__("Download")}
</button>
<button class="grid-upload btn btn-xs btn-secondary hidden">
<button type="button" class="grid-upload btn btn-xs btn-secondary hidden">
${__("Upload")}
</button>
</div>
@ -1201,7 +1201,8 @@ export default class Grid {
const $wrapper = position === "top" ? this.grid_custom_buttons : this.grid_buttons;
let $btn = this.custom_buttons[label];
if (!$btn) {
$btn = $(`<button class="btn btn-secondary btn-xs btn-custom">${__(label)}</button>`)
$btn = $(`<button type="button" class="btn btn-secondary btn-xs btn-custom">`)
.html(__(label))
.prependTo($wrapper)
.on("click", click);
this.custom_buttons[label] = $btn;