Merge pull request #8427 from tchak/fix-autosave-with-submitter
fix(js): fix submitter attributes not recognised by safari
This commit is contained in:
commit
65e125b4ec
1 changed files with 7 additions and 1 deletions
|
@ -74,6 +74,12 @@ export class AutosubmitController extends ApplicationController {
|
||||||
const submitter = this.hasSubmitterTarget ? this.submitterTarget : null;
|
const submitter = this.hasSubmitterTarget ? this.submitterTarget : null;
|
||||||
const form =
|
const form =
|
||||||
submitter?.form ?? this.element.closest<HTMLFormElement>('form');
|
submitter?.form ?? this.element.closest<HTMLFormElement>('form');
|
||||||
form?.requestSubmit(submitter);
|
|
||||||
|
// Safari does not support "formaction" attribute on submitter passed to requestSubmit :(
|
||||||
|
if (submitter && navigator.userAgent.indexOf('Safari') > -1) {
|
||||||
|
submitter.click();
|
||||||
|
} else {
|
||||||
|
form?.requestSubmit(submitter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue