Content editable div add BR tag at the end -> cursor position is bad.

RESOLVED INCOMPLETE

Status

()

Firefox
Untriaged
RESOLVED INCOMPLETE
4 years ago
2 years ago

People

(Reporter: David Van De Velde, Unassigned)

Tracking

24 Branch
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

4 years ago
Created attachment 821565 [details]
ContentEditableDiv.png

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0 (Beta/Release)
Build ID: 20130910160258

Steps to reproduce:

Create a content editable div. Overwrite keydown - keykode 13 (Enter). Add tag using the following code:
                                var selection = window.getSelection();
                                var range = selection.getRangeAt(0);
                                var br = document.createElement("br");

                                range.deleteContents();
                                range.insertNode(br);
                                range.collapse(false);
                                range.setStartAfter(br);
                                range.setEndAfter(br);

                                selection.removeAllRanges();
                                selection.addRange(range);
                                e.preventDefault();

Type 'test' in the content editable div and press 'Enter'.


Actual results:

A br tag was added after 'test'. The cursor position is on the same height of 'test' and and the beginning of the word.


Expected results:

A br tag should be added after 'test'. The cursor should be on the next line at x position 0;
I cannot reproduce the issue on latest release(43.0.4) and the latest Nightly(46.0a1) using only the code that you provided. Providing more info regarding the code that you used, would be helpful. Please create a simplified test case an attach it to the issue or use https://jsfiddle.net and paste the link.

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0
Build ID: 20160105164030

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0
Build ID: 20160111030207

Can you please try to reproduce this on the latest release(43.0.4) and latest Nightly(46.0a1) and provide the results?
When doing this, you could create a new clean Firefox profile, or maybe test in safe mode, as some of this issues may be caused by third party installed addons or custom settings
(https://support.mozilla.org/en-US/kb/troubleshoot-and-diagnose-firefox-problems).
Flags: needinfo?(david.vdv)
Hi,

Considering the fact that the reporter did not provide more informations on my request, I will mark this issue as Resolved - Incomplete.
If you can still reproduce this, feel free to reopen it and provide the requested information.

Thanks
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Flags: needinfo?(david.vdv)
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.