replacements: fix submit button not working in Chrome.
Fix the submit button in the post replacement dialog doing nothing in Chrome. When the submit button in a dialog box is clicked, we tried to fire a 'submit' event on the form to submit it. Apparently this no longer works in Chrome. `requestSubmit` is the modern way to programmatically submit a form, but it's not supported by Safari, or by versions of Firefox or Chrome released before 2019-2020. https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/requestSubmit https://caniuse.com/mdn-api_htmlformelement_requestsubmit
This commit is contained in:
@@ -61,7 +61,13 @@ Utility.dialog = function(title, html) {
|
|||||||
buttons: {
|
buttons: {
|
||||||
"Submit": function() {
|
"Submit": function() {
|
||||||
let form = $dialog.find("form").get(0);
|
let form = $dialog.find("form").get(0);
|
||||||
Rails.fire(form, "submit");
|
|
||||||
|
if (form.requestSubmit) {
|
||||||
|
form.requestSubmit();
|
||||||
|
} else {
|
||||||
|
form.submit();
|
||||||
|
Rails.fire(form, "submit");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Cancel": function() {
|
"Cancel": function() {
|
||||||
$dialog.dialog("close");
|
$dialog.dialog("close");
|
||||||
|
|||||||
Reference in New Issue
Block a user