Closed
Bug 1490126
Opened 6 years ago
Closed 6 years ago
Firefox scrolls to a contenteditable item when addRange selects it, even if it is immediately removed from the document. Chrome does not.
Categories
(Core :: DOM: Selection, defect, P3)
Core
DOM: Selection
Tracking
()
RESOLVED
DUPLICATE
of bug 1436906
Tracking | Status | |
---|---|---|
firefox64 | --- | affected |
People
(Reporter: twisniewski, Unassigned)
References
Details
(Whiteboard: [webcompat])
Attachments
(1 file)
(deleted),
text/html
|
Details |
In the attached testcase, a contenteditable element is added to the document, is made part of the document's selection with addRange, then removed.
Blink and WebKit do not bother scrolling the element into view, given that it is removed right away. Firefox does.
It seems that such code is used by live sites to do feature detection, which causes their pages to scroll down mysteriously upon page-load in Firefox.
For interop, it may be worth delaying until the next event loop before attempting to scroll, and only doing so if the element remains attached to the document at that stage (at least that superficially appears to be what Chrome is doing).
Flags: webcompat?
Comment 1•6 years ago
|
||
Masayuki probably knows why we do this.
Component: DOM → Editor
Flags: needinfo?(masayuki)
Comment 2•6 years ago
|
||
Current behavior was introduced by bug 1318312. Chrome sets focus to a contenteditable element when it gets selection range. We need to do same behavior for web-compat. IIRC, Chrome does not scroll to focused editor in this case, but we do it because scrolling to new focused element is our traditional behavior.
Perhaps, we still need to move focus synchronously for execCommand etc, however, it might be possible to put off scrolling to the editor to the next event queue. If JS removes all selection ranges like the testcase, we should stop scrolling.
Updated•6 years ago
|
Priority: -- → P3
Updated•6 years ago
|
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Updated•6 years ago
|
Component: Editor → Selection
You need to log in
before you can comment on or make changes to this bug.
Description
•