You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
+1 This is also the case for Slack. Maybe this is a CR/LF thing? On other apps, enter is interpreted correctly as a new line instead of a post. Signal and WhatsApp get it correctly. Interestingly it works as intended on Gboard.
If you're coming here to find a solution for the simple-keyboard JavaScript library, this is not the one you're looking for 😅.
For some reason, both Google and Bing searches led me to this issue repeatedly over the last two days, and I initially thought Enter key functionality was not supported in the simple-keyboard library.
However, after a deep inspection of the simple-keyboard library's code, I discovered that there is a built-in option you can use:
options.newLineOnEnter:
You can set this option based on your requirements to handle the Enter key functionality directly within the library.
Example:
constkeyboard=newKeyboard({newLineOnEnter: true,// This enables adding a newline when the "Enter" key is pressed});
This will automatically handle the "Enter" key and insert a new line (\n) at the current cursor position without the need for manual handling.
🎯 Key takeaway:
If you're trying to add a newline on the Enter key press in simple-keyboard, just set the newLineOnEnter option to true. It works out of the box!
Certain apps like discord have a separate submit button, and expect the enter key to be used to enter a new line.
It would be nice to have simple keyboard match this functionality.
The text was updated successfully, but these errors were encountered: