Description
Describe the bug
Hi!
I was trying to fully customize the UI of Blocknote by first replacing the Suggestion menu component (still keeping the controller though).
I was using my own design system component (Fractal, based on RadixUI) to build the slash menu and everything worked fine at first.
But then, I wanted to support "submenus" still using one of my components based on the Popover of RadixUI.
It occurs that RadixUI is using focus trap in there Popover component and this caused an issue with BlockNote: as soon as I hovered the trigger of the Popover, the whole suggestion menu disappeared.
I dig a bit in the BlockNote source code (cloning the repo in local and testing different things in the playground) and quickly realized that it came from this bit of code: when the Popover is shown, RadixUI steals the focus, which in turn triggers a blur event in the suggestion menu plugin which in turn completely hide the suggestion menu.
Getting rid of RadixUI (and thus the focus trap) made the sub-menu display properly, but the first click on an item of the submenu didn't triggered the "onItemClick" function but a blur. However a second click did worked properly 🤔.
To Reproduce
Here is a StackBlitz with the full reproduction of the custom suggestion menu that is using Fractal's menu and submenus: https://stackblitz.com/edit/vitejs-vite-x7ytx5?file=src%2FApp.tsx
Misc
- Node version: 18.9.1
- Package manager: Yarn 4.1.1
- Browser: Opera 107.0.5045.21