Open Bug 1757194 Opened 2 years ago Updated 2 years ago

contenteditable overwrite deletes too many nodes

Categories

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

Firefox 97
defect

Tracking

()

Tracking Status
firefox99 --- affected

People

(Reporter: scalesjordan, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: parity-chrome)

Steps to reproduce:

  1. Paste the following into your address bar

    data:text/html;charset=utf-8,<main contenteditable><div><div>foo</div></div><div><div>bar</div></div></main>
    
  2. Select from the beginning of the first line to the end of the second line

  3. Verify the selection begins and ends at text nodes

  4. Enter a character “x” to “overwrite” the selection

Actual results:

See that the nested divs are gone entirely

<main contenteditable="">q</main>

Expected results:

See that the remaining text “x” is contained within two nested divs

<main contenteditable=""><div><div>q</div></div></main>

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Selection' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

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

Confirmed with Ubuntu 20.04.

Chrome's behavior is the one expected by the reporter.

The selection (document.getSelection()) is as expected. If this is indeed considered a bug, it's in editor. I wrote "if", because editor behavior isn't specified, but the reporter's expectation seems reasonable.

Component: DOM: Selection → DOM: Editor
Keywords: parity-chrome

Yeah, our editor deletes parent block elements too when it becomes empty...

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Unspecified → All
Priority: -- → P3
Hardware: Unspecified → All
You need to log in before you can comment on or make changes to this bug.