TextArea Shortcutlistener for Enter Key

I have a RichTextArea taMessage, and I added it a shortcutlistener;

taMessage.addShortcutListener(new ShortcutListener(“Send”, KeyCode.ENTER, null) {

        public void handleAction(Object sender, Object target) {

But this does not work when the textArea is focused, it just gaves a new line. What I think is , textArea has a default shortcutListener for Enter key and when it is pressed it creates a new line. But when I use this code for KeyCode.ESCAPE it works as expected even when the textArea is focused. Is there a way to disable this new line feature when pressed enter and change it ?

Still looking for a solution but could not find anything useful.

Have you tried https://vaadin.com/directory/component/keyactions ?


Olli Tietäväinen:
Have you tried https://vaadin.com/directory/component/keyactions ?


Hi Olli, thank you for the answer. This is exactly what I was looking for.

No problem, glad you found it useful!