0

I use quill with react, and I added a binding for key 13 (enter) to send the message (shift enter for new line).

Works perfectly on PC, but in mobile I don't want it to happen. In mobile I want the regular behavior (new line), so if the user wants to send the message - he can just click 'submit'.

I thought about parsing the user-agent string, or somehow detecting a virtual-keyboard, but I'm looking for something more reliable.

Is there a correct way to do that?

Diamant
  • 11
  • 1
  • you can detect if user is using a mobile device for the site then disable their [Enter] key. it should be good enough – vuongvu Feb 12 '21 at 17:28
  • What is the best way for checking it? I Currently run a regex on the user-agent, but it feels flaky.. – Diamant Feb 12 '21 at 17:32
  • Found this answer, hope it's helpful: https://stackoverflow.com/a/3540295/10649754 – vuongvu Feb 12 '21 at 17:34

0 Answers0