I have a form that plays Audio on submit (Vue but nvm). It works perfect everywhere but not on iOS.
On iOS it works only on click on a button element, but it doesn't work on click on a "return" button on iOS keyboard :(
Why doesn't iOS trusts submit event but it trusts click that works in the same way?
Any tips? Thank you!
I have a "hack" solution:
Remove form
onsubmit
handler, change type of the button totype="button"
, addonclick
handler to this button and callplayAudio()
("return" key will still on keyboard, so this is fine).Add
onkeyup
event to input and callplayAudio()
onkeyCode === 13
(Enter key).
My "hack" solution works fine but is "hack" :(
<form novalidate @submit.prevent="playAudio()">
<div class="form-group">
<input
type="text"
class="form-control"
autocapitalize="off"
autocomplete="off"
spellcheck="false"
autocorrect="off"
/>
</div>
<button type="submit" class="btn btn-block">Enter</button>
</form>
iOS (xcode simulator) error on form submit:
NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.