0

I have problems with IOS return key on keyboard (in Safari on iphone for example). I am using vue js in my web application where I have textarea in chat component:

<textarea
        class="field-text__input field-text__input--height-small field-text__input--max-height"
        rows="1"
        ref="messageField"
        placeholder="Your message"
        @keydown.enter.exact.prevent="send"
        @keyup.enter.ctrl.exact="expandTextarea"
        :value="messageText"
        @input="updateMessage">
</textarea>

On desktop browser or android devices message is sent on "Enter" click. But on IOS click on "return" key on keyboard also send message. How I can prevent this action for IOS "return" key? Thanks for any help.

Sergey Bogdanov
  • 451
  • 1
  • 3
  • 9

1 Answers1

1

You would have to create some custom logic inside your send function in order to catch and return(quit) the function if you detect that it is an iOS device.

This stackOverflow answer is a great place for inspiration for sniffing user agens (What the device tells you it is)

Sølve Tornøe
  • 3,038
  • 15
  • 27