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

[Bug]: BubbleMenu extension prop shouldShow is never called #6147

Open
1 task done
danipalli opened this issue Mar 1, 2025 · 0 comments
Open
1 task done

[Bug]: BubbleMenu extension prop shouldShow is never called #6147

danipalli opened this issue Mar 1, 2025 · 0 comments
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@danipalli
Copy link

Affected Packages

@tiptap/extension-bubble-menu

Version(s)

2.11.5 (latest)

Bug Description

I noticed that the shouldShow property of the extension configuration does not work properly.
It is never called and therefore even returning false as no effect and the BubbleMenu will be always shown.

Example:

...
BubbleMenu.configure({
  shouldShow: () => {
    console.log("I have been called");   // <------- never called
    return false;
  },
}),

Browser Used

Firefox

Code Example URL

https://codesandbox.io/p/sandbox/tiptap-bubblemenu-bug-y65ccv

Expected Behavior

If false is returned by shouldShow, then the BubbleMenu must not be displayed.

Additional Context (Optional)

If someone else encounters this issue, a possible workaround is to apply the shouldShow property to the BubbleMenu directly:

<BubbleMenu
  ...
  shouldShow={({ editor, view, state, oldState, from, to }) => {
    return (
      from !== to &&
      /* your condition here */
    );
  }}
>
...

In addition you may want to use some conditions from here to further enhance the workaround:
https://github.com/ueberdosis/tiptap/blob/develop/packages/extension-bubble-menu/src/bubble-menu-plugin.ts#L86-L105

Dependency Updates

  • Yes, I've updated all my dependencies.
@danipalli danipalli added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Mar 1, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Tiptap: Issues Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
Status: Needs Triage
Development

No branches or pull requests

1 participant