Skip to content

Page jumps around with CodeMirror instances below the fold #4

@stiang

Description

@stiang

I figured it would be better to have a separate issue for this, so here is what @scniro wrote about it in #3:

@stiang thanks for the feedback and sharing more details on this secondary issue! I indeed get the page jump you describe when I have enough instances on the page. This side effect seems to have been introduced from the fix I implemented for #1 - specifically, preserving and setting the cursor position. The page is jumping down because it's trying to set the cursor for the last instance, even if untouched and is internally at 0,0.

Without a change, there is a workaround currently but I'm not thrilled with it. If you specify resetCursorOnSet={true} - you'll be okay and the page won't jump. However, you'll not be getting a cursor position saved/set for your editor. There may be a better way to address this now that both sides of the above mentioned fix have surfaced. In the least, I'll be renaming this prop soon (I don't think it's very descriptive). Also please give #1 a look for some background on the issue should my suggestion not make total sense here.

I can confirm that resetCursorOnSet={true} fixes the jumping-around-issue, but unfortunately it resets the cursor even in the active CodeMirror instance (the one you’re typing in), so that doesn’t really work. And even if it did, for my use case it would be best to retain the cursor position in all instances.

It would be awesome if you were able to come up with a fix :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions