Odd behavior with NodeView and 'atom' Node


Hello, I’ve been working on implementing MathQuill inside Prosemirror. In doing so, I tripped over some strange behavior when MathQuill is focused and I’m trying to select something in Prosemirror:

  1. Click inside PM: Transaction fired, cursor appears as expected.
  2. Click inside MQ: Focus event fired. selectNode fired. Transaction fired. Cursor appears in MQ as expected.
  3. Click inside PM: Nothing appears to happen.
  4. Click inside PM: deselectNode fired. Transaction fired. Cursor appears in PM as expected.

Here’s a minimal example on Glitch. Try clicking inside the MathQuill box and then clicking on the surrounding paragraph text.

view source button

I talked to Denis (who created the original Prosemirror/MathQuill integration) and we found out that when I removed the ‘atom’ flag from the Node, the whole thing worked fine. But when we read the documentation, ‘atom’ seems appropriate for this node:

atom: ?⁠bool

Can be set to true to indicate that, though this isn’t a leaf node, it doesn’t have directly editable content and should be treated as a single unit in the view.

I’m just curious why ‘atom’ breaks the NodeView in this way? Are you not supposed to mark a Node as an ‘atom’ if it has a NodeView?


So am I. The problem doesn’t appear to occur on Firefox, and none of the uses of isAtom look like they would cause this behavior, especially since the clicked-on node is not the one marked as atom, so I’m not sure what’s going on here.

(Also, this is really not how you use OrderedMap instances:




All right, thanks for looking into it. It must be some Chrome/Mathquill bug. Glad to know I wasn’t misunderstanding the docs.

(And, uh, sorry about that code, I was rushing when I made the example)