TextArea Shortcutlistener for Enter Key

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

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

        @Override
        public void handleAction(Object sender, Object target) {
                send(taMessage.getValue);
        }

});
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

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

-Olli

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

No problem, glad you found it useful!