Open Bug 744408 Opened 12 years ago Updated 2 years ago

Extra BR inserted in pre-wrap contenteditable DIV after select all & delete.

Categories

(Core :: DOM: Editor, defect)

11 Branch
x86_64
Linux
defect

Tracking

()

Tracking Status
firefox75 --- affected
firefox76 --- affected

People

(Reporter: albright, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.15 Safari/536.5

Steps to reproduce:

1. Enter some text in the content editable div with white-space: pre-wrap in the supplied sample page.
2. Inspect the DOM of the DIV to see that there is no BR tag.
3. Select all text and press backspace.


Actual results:

After deleting all text a BR tag (w/ _moz_dirty attribute) is inserted in the DIV.


Expected results:

BR tag should not be inserted. Firefox does not insert a BR tag if you manually backspace through the characters inserted, only if you select all and delete. This makes it impossible to know whether to expect this BR or not in the resulting value of the input.  This bug appears to be present in all recent versions of Firefox.
Attachment #613997 - Attachment mime type: text/plain → text/html
Confirmed with 2013-08-24-03-02-03-mozilla-central-firefox-26.0a1.en-US.linux-x86_64.  Inspector shows "<br></br>".
Component: Untriaged → Editor
Product: Firefox → Core
Summary: Extra BR inserted in pre-wrap content editable DIV after select all & delete. → Extra BR inserted in pre-wrap contenteditable DIV after select all & delete.
This bug is still very much present in FF39, reproducible using Google Hangouts in Gmail, Inbox, or G+:

Steps to repro:
1. start a chat with someone, type in some message
2. delete the message using backspace
3. click anywhere outside the chat frame (e.g. open an email, click on an empty spot, or anywhere outside the chat frame)
4. click inside the area where previous messages are displayed, note that the mesage input area regains focus and cursor is shown
5. type a message, note that a BR is added above the message
6. this is repeatable to insert as many BRs as repeated
Flags: needinfo?(ehsan)
What info are you requesting from me?
Flags: needinfo?(ehsan)
Oh, I realize now that I asked Tim to file a follow-up bug for this issue in bug 911201...
See Also: → 911201
I confirm this is still an issue on ff47

"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101 Firefox/47.0"

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

Confirmed

Both with Backspace and Delete

Status: UNCONFIRMED → NEW
Ever confirmed: true

I think this and bug 1513303 are the same.

Confirmed on Firefox 75 white-space:pre-wrap is not required, should I change summary?

When you have a final whitespace at the end of the contenteditable, when you remove the <br> programatically, then if you type any character after the whitespace, then the whitespace get removed and is replaced with the new character

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: