Preventing editor from blur (With confirmation message)

Hi, New to prosemirror, I have setup everything as expected, but I can’t prevent editor from loosing focus programatically.

I tried to subscribe to “blur” via “handleDOMEvent”, but preventing default has no effect (logging in console works)

{
        blur: (view, event) => {
          console.log("blur")
          if (window.confirm('Are you sure?')) {
            return true
          } else {
            event.preventDefault()
            // view.focus() (using this causes infinite confirm loop)
            return true
          }
        },
      }

Is this the way to achieve this? Is there another? Thanks!

Just don’t do this. It’s a terrible idea and breaks how focus works in the user’s browser.

Thanks for replying, you are absolutely right, I changed the initial design in the meantime.