Weird Enter keypress behavior in nested block node

Hello Marijn,

We have created a custom node type in our editor. The nodeSpec fields content and toDom are as below:

export const panel: NodeSpec = {
  content: 'block*',
  toDOM(node: Node): [string, any] {
    return [
      ['span', { class: contentStyle }, 0]

The issue we are facing is when hitting Enter, it seems to be creating a new paragraph but not moving cursor to new line. (Gif attached).

It works perfect if we change content to content: 'blockquote' (or a node similar in structure to blockquote).

I am not sure if its a bug in prose-mirror or our schema declaration needs to be changed for this nesting. Can you plz suggest.

That was a bug in the selection-updating code. This patch should help.

Thanks a lot @marijn

Hi Marijn,

The patch is fixing the issue but it seems to be creating this other problem, we are using it in Atlassian Bitbucket editor. Can you plz check.

I can’t reproduce that behavior. Which browser does it happen in? Browsers are pretty terrible about drawing the cursor in the right place, but so far adding a <br> to empty textblocks has been a reliable workaround for the cursor-at-the-right bug.

Unless I’m really bad at reading, you still don’t seem to have mentioned which browser it happens in. I’m not seeing it in Chrome or Firefox.

Hi Marijn,

I was able to reproduce this on Chrome 57.0, but after upgrading to 58.0, I no longer can.

I see. Since Chrome updates tend to spread pretty quickly, that makes it a rather low-priority issue for me.

I’m having the same problem on prosemirror-view@1.15.7, when I create a new paragraph, the cursor doesn’t move down, so I moved it using transaction.setSelection and it worked, except for the Cursor that doesn’t update until I type something. I checked the source code and apparently it only updates when there’s an actual selection (in case of no selection, was the browser supposed to handle the update?), I made these changes and it fixed the problem:

  if (updateSel) {
    var forceSelUpdate = updateDoc && ( || && !this.composing &&
-        !prev.selection.empty && !state.selection.empty && selectionContextChanged(prev.selection, state.selection);
+        selectionContextChanged(prev.selection, state.selection);
    if (updateDoc) {