Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

Should not try to scroll cursor into view while hidden #1236

@njx

Description

@njx

In endOperation(), if the selection has changed, we call calculateScrollPos() to figure out how to scroll the selection into view. However, if the editor is hidden, calculateScrollPos() returns a bogus value, because display.scroller.clientHeight is 0. This value can end up getting saved off in doc.scrollTop, which then messes up future refresh() operations that try to use the cached value. (In our case, where we have a small hidden inline editor, the bad scroll value actually causes the content to become invisible, because it essentially scrolls the entire content out of view.)

We currently have an interim fix that simply skips the block containing the newScrollPos = calculateScrollPos(...) if display.scroller.clientHeight is 0. I can submit that as a pull request, but I suspect it's not the fix you'd want long term, because you probably do eventually want to scroll the cursor into view once the editor becomes visible again. (In our case, we don't happen to need that right now.) So perhaps you'd want to keep a flag indicating that the scroll should happen on the next refresh() (if the editor is visible at that point).

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