Bug 220499 - textarea placeholder does not respect newlines
Summary: textarea placeholder does not respect newlines
Status: RESOLVED DUPLICATE of bug 217837
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-01-09 14:01 PST by Terence Eden
Modified: 2021-08-19 09:08 PDT (History)
6 users (show)

See Also:


Attachments
Screenshot of error. (50.76 KB, image/png)
2021-01-09 14:01 PST, Terence Eden
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Terence Eden 2021-01-09 14:01:15 PST
Created attachment 417343 [details]
Screenshot of error.

Placeholder text in a textarea can have newlines. But WebKit strips them out.

Steps to reproduce:

Create a `<textarea>` with a multi-line placeholder.

```
<textarea placeholder="In loving memory of
Buffy Anne Summers
She saved the world
A lot..."></textarea>
```

Actual results:

The placeholder renders as a single line. The newlines are removed and there's no replacement whitespace:

`In loving memory ofBuffy Anne SummersShe saved the worldA lot...`


Expected results:

Placeholder should display over multiple lines.

Spec:

> User agents should present this hint to the user when the element’s value is the empty string and the control is not focused (e.g., by displaying it inside a blank unfocused control). All U+000D CARRIAGE RETURN U+000A LINE FEED character pairs (CRLF) in the hint, as well as all other U+000D CARRIAGE RETURN (CR) and U+000A LINE FEED (LF) characters in the hint, must be treated as line breaks when rendering the hint.

https://www.w3.org/TR/html52/sec-forms.html#element-attrdef-textarea-placeholder

I've tested this on WebKitGTK 2.30.4 on Linux, and seen the problem on the latest Safari for iPhone.

(This bug was also reported to Firefox, and fixed - https://bugzilla.mozilla.org/show_bug.cgi?id=1391044)
Comment 1 Radar WebKit Bug Importer 2021-01-16 14:02:14 PST
<rdar://problem/73285124>
Comment 2 Claude Pache 2021-08-19 01:13:42 PDT
This is a duplicate of Bug 217837
Comment 3 Simon Fraser (smfr) 2021-08-19 09:08:41 PDT

*** This bug has been marked as a duplicate of bug 217837 ***