Bug 220499

Summary: textarea placeholder does not respect newlines
Product: WebKit Reporter: Terence Eden <webkit.org>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: akeerthi, bfulgham, claude.pache, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Screenshot of error. none

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 ***