Open Bug 1668879 Opened 4 years ago Updated 4 years ago

Enter with non-collapsed selection in contenteditable may lose format which is in the non-collapsed selection

Categories

(Core :: DOM: Editor, defect, P3)

Firefox 81
defect

Tracking

()

People

(Reporter: jisong, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0

Steps to reproduce:

Open the attached test file, follow the instruction below:

Step 1: Click the button in the file
Step 2: Press Enter
Step 3: Type some text

Actual results:

text from step 3 is in black

Expected results:

text from step 3 should be in red

Component: Untriaged → DOM: Editor
Product: Firefox → Core

Hmm, I feel the behavior of Chrome is odd because the selected range starts from and ends by outer of elements whose forecolor is red. So, deleting the inner style must be reasonable in this case. But this is a web-compat issue with Blink...

jisong: Did you find this bug on existing web apps?

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Unspecified → All
Priority: -- → P3
Hardware: Unspecified → All
Summary: Enter in contenteditable DIV may lose format → Enter with non-collapsed selection in contenteditable may lose format which is in the non-collapsed selection

Masayuki:

The repro step I added was a simplified one, in order make sure everyone can repro it.
The original repro step is like this:

  1. Use the code below.
  2. Put cursor at the end of "Line 1"
  3. Press Enter twice, to generate two new empty line
  4. Press "Up" arrow twice, then everything should be selected
  5. Press Enter again
  6. Type something, see that is becomes black now.
<html>
<body>
<div contenteditable id="div1" style="border: solid 1px black; height: 200px">
<div style="color:red">line 1</div>
</div>
</body>
</html>
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: