Skip to content

contenteditable=plaintext-only should be white-space: pre-wrap by default #11350

@zcorpan

Description

@zcorpan
Member

What is the issue with the HTML Standard?

In Gecko and WebKit today, <div contenteditable=plaintext-only> without author CSS gets white-space: normal which makes Enter insert <br> elements instead of LF.

In Chromium, some values of white-space in a plaintext-only element are forced to pre-wrap.

OK, though forcing computed style is "magic". Maybe it's enough to have a normal UA style rule?

[contenteditable="plaintext-only" i] { white-space: pre-wrap; }

If developers set it back to normal then they get <br>s.

Originally posted by @zcorpan in w3c/editing#419 (comment)

@masayuki-nakano said he prefers a UA rule over Chrome's behavior of forcing computed style.

cc @tkent-google

Activity

added a commit that references this issue on Jun 3, 2025
f8927b1
added a commit that references this issue on Jun 3, 2025
0b66511
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @zcorpan

      Issue actions

        `contenteditable=plaintext-only` should be `white-space: pre-wrap` by default · Issue #11350 · whatwg/html