How to scroll textarea programmatically?

I have a one active line in CodeMirror component (based on textarea element). How to scroll it to this active line?

I use CodeMirror v6.

You can use EditorView.scrollIntoView

view?.dispatch({
  effects: EditorView.scrollIntoView(targetLine.from, {
    y: 'center',
  }),
});