Why are menu functions executed on mousedown?

prosemirror-menu triggers the run() function on mousedown:

This feels a bit unnatural on desktops where users can normally cancel pressing the button by moving the mouse somewhere else before releasing. It also causes dialogs that should be closed on outside click (like a dialog to enter a link) to directly close once the user finishes pressing the button.

Is there are a particular reason for this behavior? (I understand that I can write my own implementation - I just want to avoid shooting myself in the foot in case I oversee an important reason for the behavior :slight_smile:

This is done to avoid unfocusing the editor.

Thanks for the quick reply, @marijn! Makes sense. I’ll then just move on with creating my own MenuItem.

PS: Thanks for all your great work! It’s such a bless to work with an editor library that feels really thought through. :clap: