Closed Bug 1921162 Opened 1 month ago Closed 22 days ago

Make `HTMLEditor` aware of inputting line breaks in `contenteditable=plaintext-only`

Categories

(Core :: DOM: Editor, task)

task

Tracking

()

RESOLVED FIXED
133 Branch
Tracking Status
firefox133 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Chrome inserts a line break with either:

  • typing Enter
  • typing Shift + Enter
  • execCommand("insertLineBreak")

Those cause input events whose inputType is insertLineBreak.

However, execCommand("insertParagraph") inserts an empty paragraph or split current paragraph as same as contenteditable=true. I'm not sure whether this is intentional.

Safari also supports insertParagraph working as same as in contenteditable=true. So, we need to follow them.

Chrome treats Enter key press as insertLineBreak instead of
insertParagraph. Additionally, Chrome handles insertParagraph command
work as same as when contenteditable=true. Therefore, HTMLEditor needs
to change the behavior at handling eKeyPress event.

Depends on D224184

The behavior should be same as when contenteditable=true. Therefore,
this test checks only the basic behavior.

Depends on D224185

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/f38500099558 part 1: Make `HTMLEditor` handle `Enter` key press as `insertLineBreak` if it's in `contenteditable=plaintext-only` r=m_kato https://hg.mozilla.org/integration/autoland/rev/3856ef423b91 part 2: Add basic tests for `insertParagraph` in `contenteditable=plaintext-only` r=m_kato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/48462 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 22 days ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: