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




7 years ago
2 years ago


(Reporter: albright, Unassigned)


11 Branch

Firefox Tracking Flags

(Not tracked)



(1 attachment)



7 years ago
Created attachment 613997 [details]
Sample content editable DIV.

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.


5 years ago
Attachment #613997 - Attachment mime type: text/plain → text/html

Comment 1

5 years ago
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


5 years ago
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.

Comment 2

3 years ago
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)

Comment 3

3 years ago
What info are you requesting from me?
Flags: needinfo?(ehsan)

Comment 4

3 years ago
Oh, I realize now that I asked Tim to file a follow-up bug for this issue in bug 911201...
See Also: → bug 911201

Comment 5

3 years ago
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"
You need to log in before you can comment on or make changes to this bug.