Undesired scrolling on updateState

Edit: This seems to be tangentially related to https://github.com/ProseMirror/prosemirror/issues/933. I applied the same workaround addressed in the issue: setting overflow-anchor: none. This fixed the problem, though I don’t understand why the patch in the aforementioned issue doesn’t work in this case. I must be doing something weird.

I’m experiencing a strange scrolling issue once documents get to be of a certain length. If the scroll is at the top portion of the scrollbar, this doesn’t occur, but once I scroll down a certain amount, every call to (prosemirror-model) updateState causes the scroll to jump downwards.

I’ve been banging my head against this for a couple of days now. I actually changed the padding on the container that’s holding the prosemirror editorview instance and that stopped the jumping at least temporarily, but later I found it had returned. I also played with some of the handleScroll props on EditorView, but I didn’t really have a good idea what I was trying to accomplish there.

Any tips on what to investigate next?

  dispatchTransaction = tx => {
    // In case EditorView makes any modification to a state we funnel those
    // modifications up to the parent and apply to the EditorView itself.
    const { state, transactions } = this.props.editorState.applyTransaction(tx);
    if (this._editorView != null) {
      this._editorView.updateState(state);
    }

    if (this.props.onChange) {
      this.cancelInProgress();
      if (transactions.some(tr => tr.docChanged)) {
        this.props.onChange(state, null, true);
      } else {
        this.inProgressChange = setTimeout(
          () => this.props.onChange(state, null, false),
          IN_PROGRESS_DEBOUNCE_INTERVAL
        );
      }
    }
  };


  componentWillReceiveProps(nextProps) {
    // In case we receive new EditorState through props — we apply it to the
    // EditorView instance.
    if (this._editorView) {
      if (nextProps.editorState !== this.props.editorState) {
        this._editorView.updateState(nextProps.editorState);
      }
    }
  }

Can you reproduce this on the website examples? If not, you could try removing elements from your setup piece by piece to reduce it to that kind of minimal setup, and see where the problem stops.

Sorry I abandoned this thread! To anyone Googling for answers, this problem has shown up over a few generations of my application, and it’s always due to not properly managing the height of my containing divs. I imagine PM then gets an incorrect report of the height or visibility of the document, resulting in the aforementioned scroll behavior.

Sorry I don’t have anything more scientific; fixing it usually involves going through each parent container, making sure its actual height matches the visual height. More often than not, a containing div would be shooting off the end of the screen.