Repository navigation
fix(core): keep the formatting toolbar hidden when focus returns to editor UI - #3187
Conversation
…ditor UI When focus came back from outside the editor into its UI (e.g. the drag handle), the toolbar showed again for the old selection, over the drag handle menu. Show it again only when the content area has focus. Closes #3186
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/diagram-block
@blocknote/mantine
@blocknote/math-block
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
@blocknote/xl-typst-exporter
commit: |
|
Closes #3186
Problem
The editor has a selection, and focus is outside the editor. The user clicks a drag handle. The formatting toolbar shows again, over the drag handle menu.
The focus handler from #3031 counts the editor's UI as part of the editor. Focus that moves from outside onto the drag handle shows the toolbar for the old selection.
Fix
When focus comes back, show the toolbar only if the content area has focus (
editor.isFocused()). Thepointeruphandler in the same file already uses this check.Tests
New test in
draghandle.test.tsx: select text, move focus outside the editor, click a drag handle. The toolbar must stay hidden. The test fails without the fix in chromium, firefox and webkit.Summary by CodeRabbit