1

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:

  1. Remove form onsubmit handler, change type of the button to type="button", add onclick handler to this button and call playAudio() ("return" key will still on keyboard, so this is fine).

  2. Add onkeyup event to input and call playAudio() on keyCode === 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.

0 Answers0