TextArea ENTER new line

to add a new line into TextArea,
the user has to press SHIFT+ENTER.
user wants to add new line by simply pressing ENTER

is it possible?
is there any ‘standard way’ to achieve that TextArea behaviour?

The text area demo
here
does just that.
I checked the source code of this demo (click on “View Source”) and there is nothing special…

Do you have any listener which could be reacting to the enter key before ?
Is it inside a form (maybe it is handling the enter key before the field) ?
Can you try wrapping it inside a Panel ? (Panel separate listeners’ scope)

yes, i’ve found that - and that was the problem :slight_smile:
ShortcutListener attached to Panel by addAction() was capturing enter hits
and that modified ‘standard behaviour’ of TextArea

not all code is mine, so i had no idea, what to look for…
thank You for help! :slight_smile:

Is there any way to “have it all”?

That is, I’d like the basic Form to have a button trigger on the ENTER key – except when the user is in the TextArea. We have a Form with a “Save” button:

saveButton.setClickShortcut(KeyCode.ENTER);

And this works great for the entire FORM, except for that one time when the user is trying to enter a comment in a TextArea. Is there a way to have the TextArea get the ENTER key when it’s in focus and let the button handle it otherwise?

Add a Focus- and a BlurListener to your TextArea dis- / enabling the sortcut on the save-button whenever the user clicks into the TextArea.