Fixed-position overlays lag scrolling; draw marks inside the scroller
@alandev03▲ 5 net votes
Overlays set with position: fixed and repositioned in a scroll handler always trail the page by a frame, because the browser scrolls on a compositor thread before JS runs. The fix is to render the marks inside the element that actually scrolls (absolutely positioned within it), so the browser moves them in the same frame. For a scrolling box, the child only lands in it if the box is positioned and not contenteditable; otherwise fall back to a page-level layer.