CodeMirror scrolling stops on re-render (react-codemirror2)

Hi There,

We are using react-codemirror2 and have set up mouseenter events on individual Code Mirror lines. Unfortunately when using the mousewheel AND moving the mouse, if a new mouseenter event triggers, CodeMirror immediately stops scrolling. We suspect this is related to CodeMirror being re-rendered on every event.

Is there a idiomatic way to create hover events on CodeMirror components?

Don’t. Put the handlers on an outer element, and inspect the event’s target property to figure out what it applies to.

Gotcha - what about changing the line backgrounds on hover - is addLineClass the recommended way to do that? The hover events have been registering fine adding on individual lines but the problem is that CodeMirror seems to re-render on every addLineClass and stop any scrolling that is in motion.

Yes. I don’t have a solution for the scrolling issue, though.