react: [Bug]: TipTap package issues
Prerequisites
- I have searched existing issues to ensure this bug hasn’t been reported already
- I have tested this with the latest version of the components
Bug description
Errors like this in the console:
Attempted import error: 'BubbleMenu' is not exported from '@tiptap/react' (imported as 'BubbleMenu').
Resulting from the text editor component.
I’ve put a fix that I’ve used below. Given this is one of your paid-for components I’ve been restrictive in how much I’ve copied in. If you want me to send the full files somewhere private I can do.
Steps to reproduce
- Install text editor component
- Use text editor component
Expected behavior
No errors in console. Bubble menu doesn’t show.
Actual behavior
Errors in console, and bubble menu appears.
Code example
Browser
No response
Device type
No response
Component version
No response
Environment details
No response
Screenshots/Videos
No response
Console errors
`Attempted import error: 'BubbleMenu' is not exported from '@tiptap/react' (imported as 'BubbleMenu').`
Additional context
I used Cursor to fix this. After a few rounds, we came up with the following:
- Update all of the tiptap packages to v3:
"@tiptap/core": "^3.0.7",
"@tiptap/extension-blockquote": "^3.0.7",
"@tiptap/extension-bold": "^3.0.7",
"@tiptap/extension-bullet-list": "^3.0.7",
"@tiptap/extension-color": "^3.0.7",
"@tiptap/extension-document": "^3.0.7",
"@tiptap/extension-font-family": "^3.0.7",
"@tiptap/extension-font-size": "^3.0.0-next.3",
"@tiptap/extension-heading": "^3.0.7",
"@tiptap/extension-history": "^3.0.7",
"@tiptap/extension-image": "^3.0.7",
"@tiptap/extension-italic": "^3.0.7",
"@tiptap/extension-link": "^3.0.7",
"@tiptap/extension-list-item": "^3.0.7",
"@tiptap/extension-ordered-list": "^3.0.7",
"@tiptap/extension-paragraph": "^3.0.7",
"@tiptap/extension-placeholder": "^3.0.7",
"@tiptap/extension-text": "^3.0.7",
"@tiptap/extension-text-align": "^3.0.7",
"@tiptap/extension-text-style": "^3.0.7",
"@tiptap/extension-underline": "^3.0.7",
"@tiptap/pm": "^3.0.7",
"@tiptap/react": "^3.0.7",
- Update the
text-editor-tooltipto useupdateDelay:updateDelay={100}, nottippyOptions, and import Bubble menu like this:import { BubbleMenu } from "@tiptap/react/menus"; - Update the
text-editor:- Add immediately render:
editable: !isDisabled,
immediatelyRender: false,
extensions: [
- Update the imports
import { BubbleMenu } from "@tiptap/react/menus";
import type { ComponentProps, HTMLAttributes, ReactNode, Ref } from "react";
import { createContext, useContext, useEffect, useId } from "react";
import { CharacterCount } from "./text-editor-character-count";
import { TextEditorAlignCenter, TextEditorAlignLeft, TextEditorBold, TextEditorItalic, TextEditorLink, TextEditorUnderline } from "./text-editor-extensions";
import { TextStyle } from "@tiptap/extension-text-style";
- Return using the bubble menu:
return (
<>
<BubbleMenu
editor={editor}
updateDelay={100}
className="dark-mode z-10 flex flex-wrap gap-0.5 rounded-xl bg-primary p-1.5 shadow-lg ring-1 ring-secondary ring-inset md:flex-nowrap"
>
<TextEditorBold />
<TextEditorItalic />
<TextEditorUnderline />
<TextEditorAlignLeft />
<TextEditorAlignCenter />
<TextEditorLink />
</BubbleMenu>
<EditorContent disabled={isDisabled} {...props} editor={editor} />
</>
);
Accessibility impact
- This bug affects keyboard navigation
- This bug affects screen reader users
- This bug affects focus management
- This bug affects color contrast or visual accessibility
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 1
- Comments: 16 (12 by maintainers)
We can’t just release it to prod without having tested it as it’s used in other places as well.