fix: slash menu - stopPropagation on mousedown blocks ProseMirror selectionUpdate
Some checks failed
Deploy to Production / Build and Deploy (push) Has been cancelled

This commit is contained in:
2026-05-02 22:20:48 +02:00
parent 1bbfb775bc
commit f7ff2f8dfd

View File

@@ -483,10 +483,11 @@ function SlashCommandMenu({ editor, onInsertImage }: { editor: Editor; onInsertI
ref={menuRef}
className="notion-slash-menu"
style={{ top: coords.top, left: coords.left }}
onMouseDown={() => {
// Block selectionUpdate handler while interacting with menu
onMouseDown={(e) => {
e.preventDefault() // prevent editor from losing focus
e.stopPropagation() // prevent ProseMirror from seeing the mousedown → no selectionUpdate
menuInteracting.current = true
setTimeout(() => { menuInteracting.current = false }, 200)
setTimeout(() => { menuInteracting.current = false }, 300)
}}
onClick={(e) => e.stopPropagation()}
>