Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.
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

Open

Description

@hubgit

Describe the issue

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?

cm6-scrollbar.mov

Browser and platform

Chrome, macOS

Reproduction link

https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge2phdmFzY3JpcHR9IGZyb20gIkBjb2RlbWlycm9yL2xhbmctamF2YXNjcmlwdCIKCm5ldyBFZGl0b3JWaWV3KHsKICBkb2M6ICJoZWxsbyBoZWxsbyBoZWxsbyBoZWxsbyBoZWxsbyBoZWxsbyBoZWxsbyBoZWxsbyBoZWxsbyBoZWxsbyBoZWxsbyBoZWxsbyBoZWxsbyBoZWxsbyBoZWxsbyBcbiIucmVwZWF0KDEwMDAwKSwKICBleHRlbnNpb25zOiBbCiAgICBiYXNpY1NldHVwLCAKICAgIGphdmFzY3JpcHQoKSwgCiAgICAvLyBFZGl0b3JWaWV3LmxpbmVXcmFwcGluZwogIF0sCiAgcGFyZW50OiBkb2N1bWVudC5ib2R5Cn0pCg==

Activity

  1. 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
  2. marijnh commented on Feb 27, 2023

    @marijnh
    Member

    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.

  3. hubgit commented on Feb 27, 2023

    @hubgit
    ContributorAuthor

    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.

  4. marijnh commented on Feb 27, 2023

    @marijnh
    Member

    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.

  5. hubgit commented on Feb 27, 2023

    @hubgit
    ContributorAuthor

    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.

  6. marijnh commented on Feb 28, 2023

    @marijnh
    Member

    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.

  7. hubgit commented on Feb 28, 2023

    @hubgit
    ContributorAuthor

    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.

  8. rmmh commented on Nov 6, 2025

    @rmmh

    This is also quite easy to reproduce by dragging the scroll bar on https://codemirror.net/examples/million/ up and down

  9. marijnh commented on Apr 15, 2026

    @marijnh
    Member

    This issue has been moved to issue #1086 on the repository's new home.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions