A plugin that simulates a tab event? (or a simple way to move to the next proseMirror view)

Say I want to move to the next proseMirror view after pressing Enter; I tried creating a plugin that simulates the Tab event but to no avail:

 handleKeyDown(view, event) {
      console.log('go', view, event)
      if (event.key === 'Enter') {

        let event = document.createEvent('Event')
        event.initEvent('keydown', true, true)
        event.keyCode = 16

        return true

I’m aware JS doesn’t really allow one to simulate a native keypress; just wondering if Prosemirror has a simple way to move to the next proseMirror view (acheiving the same thing as pressing tab)


ProseMirror has nothing like that, and I’m not sure how easy it is to figure out which element is the next focusable thing in the browser’s tab order in general (but in a specific situation where you do know that this shouldn’t be hard to script).

1 Like

@marijn I see! Thanks! Yeah I’m using React so I can just setState in the parent container and pass auto-focus as a prop respectively