You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 15, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 15, 2026. It is now read-only.
Chrome scrollbar out of sync with height of long document #1086
For as long as I can remember, it's been slightly difficult to scroll to the end of a long CM6 document in Chrome, as the scrollbar handle is out of sync with the document height.
I recently noticed that neither Firefox or Safari have this problem, so maybe it's a Chrome bug?
changed the title [-]Chrome scrollbar out of sync with long document[/-][+]Chrome scrollbar out of sync with height of long document[/+]on Feb 22, 2023
Chrome on Linux does not appear to have this issue. I guess your screenshot is from macOS? Maybe it's using the native scrollbar in some way that causes this. The height of the editor document will change as you scroll down (since the editor starts with an estimated height, and then measures the actual height of the content as it is drawn). It's possible Chrome on your platform is somehow not handling scroll height changes during a scrollbar drag correctly. That's probably not something CodeMirror can avoid.
Correct, this is Chrome on macOS. I'll investigate further and see if there are any relevant issues already reported.
the editor starts with an estimated height, and then measures the actual height of the content as it is drawn
In the demo linked above, there's no line wrapping and no decorations, so all the lines have the same height, in which case I would expect that an estimated height based on the number of lines would be correct? That's just an aside though, this still needs to handle wrapped lines of varying sizes, so getting the initial height correct (if it isn't already) would only be a first step.
Indeed, you are right—in this demo the estimated content height doesn't actually change during scrolling, so that's not it. Maybe something related to the somewhat large height of the scrolled content? I'll see if I can isolate the cause the next time I have my Apple laptop nearby.
Some more weird experimentation: in this demo, the scroll bar is incorrect, but if I remove one character from the line or reduce the number of lines by one then the scroll bar becomes correct. There seems to be a threshold at which the calculation becomes incorrect, for some reason.
Strange… I'm also using Chrome 110 and a MacBook touchpad.
A bit more experimenting: it seems to happen only at 100% and 200% page zoom, but not at any other zoom level I've tried, if I reload the page after changing the zoom level.
Activity
[-]Chrome scrollbar out of sync with long document[/-][+]Chrome scrollbar out of sync with height of long document[/+]marijnh commentedon Feb 27, 2023
Chrome on Linux does not appear to have this issue. I guess your screenshot is from macOS? Maybe it's using the native scrollbar in some way that causes this. The height of the editor document will change as you scroll down (since the editor starts with an estimated height, and then measures the actual height of the content as it is drawn). It's possible Chrome on your platform is somehow not handling scroll height changes during a scrollbar drag correctly. That's probably not something CodeMirror can avoid.
hubgit commentedon Feb 27, 2023
Correct, this is Chrome on macOS. I'll investigate further and see if there are any relevant issues already reported.
In the demo linked above, there's no line wrapping and no decorations, so all the lines have the same height, in which case I would expect that an estimated height based on the number of lines would be correct? That's just an aside though, this still needs to handle wrapped lines of varying sizes, so getting the initial height correct (if it isn't already) would only be a first step.
marijnh commentedon Feb 27, 2023
Indeed, you are right—in this demo the estimated content height doesn't actually change during scrolling, so that's not it. Maybe something related to the somewhat large height of the scrolled content? I'll see if I can isolate the cause the next time I have my Apple laptop nearby.
hubgit commentedon Feb 27, 2023
Some more weird experimentation: in this demo, the scroll bar is incorrect, but if I remove one character from the line or reduce the number of lines by one then the scroll bar becomes correct. There seems to be a threshold at which the calculation becomes incorrect, for some reason.
marijnh commentedon Feb 28, 2023
I'm not getting this effect on macOS Chrome 110 for some reason. But maybe that's because I'm scrolling with a touchpad rather than a real mouse.
hubgit commentedon Feb 28, 2023
Strange… I'm also using Chrome 110 and a MacBook touchpad.
A bit more experimenting: it seems to happen only at 100% and 200% page zoom, but not at any other zoom level I've tried, if I reload the page after changing the zoom level.
rmmh commentedon Nov 6, 2025
This is also quite easy to reproduce by dragging the scroll bar on https://codemirror.net/examples/million/ up and down
marijnh commentedon Apr 15, 2026
This issue has been moved to issue #1086 on the repository's new home.