New issue
Advanced search Search tips

Issue 807373 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 713969
Owner: ----
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

textarea creates linebreak when spacebar is pressed

Reported by erikdsi....@gmail.com, Jan 30 2018

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36

Steps to reproduce the problem:
1. create a textarea with content enough that it'll display as 2 or more lines
2. place the text cursor before the first word of the second line
3. press the space bar
a linebreak will be created instead of a space

What is the expected behavior?
a space should be created inside the textarea

What went wrong?
a line break is created instead, it can be seen by resizing the textarea to try to fit the whole content in a single line.

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 63.0.3239.132  Channel: stable
OS Version: OS X 10.13.2
Flash Version: 

tested on both macOs and ubuntu
works correctly on firefox
 
textarea-bug.html
563 bytes View Download
Labels: Needs-Triage-M64

Comment 2 by tkent@chromium.org, Jan 31 2018

Components: -Blink>Forms Blink>Editing Blink>Forms>Textarea
Status: Available (was: Unconfirmed)
Confirmed. Safari TP doesn't have this issue.

It looks this has been done intentionally, below comment explains the reason as 
// Typing spaces at the beginning of wrapped line is confusing, because inserted spaces would appear in the previous line. Insert a line break automatically so that the spaces appear at the caret. 
I do agree the "standard" way of dealing with it is confusing, but I don't think that turning a blank space into a break line on behalf of the user is any less confusing.

This problem arise from an aesthetic fix, first, I'll call a string with no line breaks a paragraph a string with line breaks a multi-line string, and a horizontally displayed string a line.

Rendering a paragraph inside a fixed width container, based on how many characters said width can contain, may leave a line starting with a blank space, which is ugly since it breaks alignment, it seems like the usual way to deal with this problem is to place the extra spaces not in the line that is created due to the width constraints but in the preceding line.

That's what I refer to as "standard" behavior and I believe that's what's being referred to as confusing, and I've seen a related bug in google docs(you can drive the cursor offscreen causing horizontal scrolling).

In my opinion, the desired behavior should be to omit the first blank space to keep alignment, but if more blank spaces are entered, they should be shown in the line created by the width constraint instead of remaining hidden in the preceding line or being turned into a line break implicitly.

Alternatively, looking at SublimeText, the behavior seems to be to treat the last word of the first line together with the following blank spaces as a single unit, which means the last word of the first line will be placed in the line created by the width constraint once the unit(word+following blank spaces) exceed the width of the container.


Mergedinto: 713969
Status: Duplicate (was: Available)
Looks like a dupe of issue 713969

Sign in to add a comment