Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include bubble menu element when checking if the editor view still has focus #3150

Merged
merged 1 commit into from
Sep 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/extension-bubble-menu/src/bubble-menu-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ export class BubbleMenuView {
const isEmptyTextBlock = !doc.textBetween(from, to).length
&& isTextSelection(state.selection)

// When clicking on a element inside the bubble menu the editor "blur" event
// is called and the bubble menu item is focussed. In this case we should
// consider the menu as part of the ditor and keep showing the menu
const isChildOfMenu = this.element.contains(document.activeElement)

const hasEditorFocus = view.hasFocus() || isChildOfMenu

if (
!view.hasFocus()
!hasEditorFocus
|| empty
|| isEmptyTextBlock
) {
Expand Down