Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

OcTextArea: Add a way to enter a line break #1422

Closed
dschmidt opened this issue Jun 24, 2021 · 10 comments · Fixed by #1517
Closed

OcTextArea: Add a way to enter a line break #1422

dschmidt opened this issue Jun 24, 2021 · 10 comments · Fixed by #1517
Assignees

Comments

@dschmidt
Copy link
Member

Steps to reproduce

  1. Type enter in OcTextArea
  2. Change event is emitted and enter is swallowed

Expected behaviour

There should be a way to enter a line break, maybe with ctrl+enter?

Actual behaviour

There is no way to enter a line break ...

Screenshots (if appropriate):

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log 
c) ...
@dschmidt dschmidt changed the title Add a way to enter a line break in OcTextArea OcTextArea: Add a way to enter a line break in Jun 24, 2021
@dschmidt dschmidt changed the title OcTextArea: Add a way to enter a line break in OcTextArea: Add a way to enter a line break Jun 24, 2021
@LukasHirt
Copy link
Collaborator

Let's go with combinations ctrl + enter and shift + enter

@kulmann
Copy link
Member

kulmann commented Jun 24, 2021

To be honest I'm always annoyed when I use a textfield that submits on enter. I'd prefer to change it entirely and use enter for line breaks and fire a change event when leaving the textarea or pressing ctrl + enter or shift + enter.

@LukasHirt
Copy link
Collaborator

I'd prefer to change it entirely and use enter for line breaks and fire a change event when leaving the textarea or pressing ctrl + enter or shift + enter.

I think this could be more harmful. At least definitely submitting on leave. If I see a comments section, fill in some text, click/focus away and suddenly it is submitted I am scratching my head what went wrong... Regarding line breaks on enter only - I'd say people will be more used to submitting it instead. If you type in a username and password and hit enter, you get logged in. If you are adding some item/people to some list, you enter name, hit enter and it's added. Suddenly you're in a text area where it's different. I know that text area and input are quite different but not sure how much users will differentiate between them. Also, I see this patter more often in websites/apps. And given especially how everything is rushed, it is much simpler to just submit a message via hitting enter only. So as long as it's not some text editor where you expect to do tens of line breaks, I think the focus is more on submitting which means it should be as easy as possible.

@dschmidt
Copy link
Member Author

Fwiw OcTextInput emits changed on enter as well ...

@kulmann
Copy link
Member

kulmann commented Jun 24, 2021

Since this is our design system, I'd think this screams make <ENTER> behaviour configurable all over the place. 😁
For the OcTextInput I'd be confused if it doesn't do anything on enter. For the OcTextArea not. I mean, right now writing a comment on github, I expect that a simple ENTER creates a line break (you're right that that's a text editor). For chat I'd expect ENTER to submit my message.

@lookacat lookacat self-assigned this Jul 20, 2021
@lookacat
Copy link
Contributor

OcTextArea will have an optional prop called submitOnEnter, this prop controls how the textarea should react to ENTER.
It will be set default to false, which means ENTER doesn't emit a change event. If its set to true ENTER will emit a change event, and CTRL + ENTER or SHIFT + ENTER will create a linebreak. This way the behaviour is configurable.

kulmann added a commit that referenced this issue Jul 22, 2021
#1422 Textarea enable linebreak (submitOnEnter)
@dschmidt
Copy link
Member Author

Is a change event emitted when the value changed and the focus is lost?

@lookacat
Copy link
Contributor

@dschmidt no not as of now, would that be a needed case?

@dschmidt
Copy link
Member Author

dschmidt commented Jul 29, 2021

Well, it's what OcTextInput does. So I kinda expect OcTextArea to behave similarly.

See also owncloud/web#8857
In that table I haven't recorded when the change event is emitted, that might still be interesting.

@lookacat
Copy link
Contributor

ok I will do an issue for that to fix it :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants