Open mhr3 opened 7 years ago
2 years ago I filed a bug against Firefox, perhaps the usage of translateX
triggers the same bug as translate3d
.
-- https://bugzilla.mozilla.org/show_bug.cgi?id=1083132
We don't use translate3d
in the editor implementation in Firefox because of this bug. We fall back to using top
and left
for scrolling in Firefox. The problem lies within Firefox and the incorrect results for getClientRects()
calls. There is no known workaround.
What do you use translate3d for in other browsers? It seems like it shouldn't be necessary in an editor.
for speed
speed of what? What's being translated?
Using translate3d
on the <div>
containing the lines in order to implement scrolling, helps browsers save significant paint times, as the usage of translate3d
helps them understand better what our custom scrolling does... it scrolls. So they can use the same pixel-shuffling optimizations that are used for native scrolling, so only the areas where lines are leaving the viewport or entering the viewport need to be repainted, all the other pixels get shuffled over from the previous frame.
Using a regular translate() along with will-change: transform should give the same performance improvement, should be fast in Firefox and may avoid the Firefox bug that you're hitting.
I don't think the will-change: transform
will resolve the OP's issue. Under Firefox, the editor does not use translate3d
. In this case, @mhr3 uses translateX
on their webpage in an indirect editor container parent.. and hits the FF bug. e.g.
<div style="translateX: 260px">
<div>
...
<div id="monaco-editor-container"></div>
...
</div>
</div>
When using mouse selection in Firefox on mobile.azure.com, the cursor doesn't match the text that gets selected, see the following video:
This might be related to our usage of CSS translate - a (non-direct) parent element in the DOM has
translateX: 260px
applied, which would seem to match the displacement. There's no such problem in Chrome/Safari nor Edge.monaco-editor version: 0.8.3 Browser: Firefox 51 OS: MacOS