fix(web): preserve editor bubble menu styles in production

Closed
SA
20d ago
+54-3

Summary

Fixes #3895. Selecting text in the homepage editor opens a horizontal formatting toolbar with the theme background again in production.

TipTap annotates a Set constructor as pure in two chained .forEach() calls. Turbopack drops the outer calls in production, including the DOM updates that apply data-re-bubble-menu and inline styles. That leaves the menu outside its layout and theme selectors.

Patch the workspace's pinned @tiptap/react@3.32.2 by removing those two annotations in both distributed formats. The workspace can drop the patch when its Next.js version includes vercel/next.js#100477.

Verification

  • Built and served apps/web in production mode before and after the patch. In Chromium, double-clicking “TypeScript” went from a transparent block with stacked controls to a white flex toolbar with data-re-bubble-menu. Clicking the toolbar's bold button formatted the selected word.
  • Ran the standalone reproduction from #3895. Next.js 16.4.6 drops the menu's data attribute and inline color. Next.js 16.5.0-canary.48 preserves both with unpatched TipTap.
  • Frozen-lockfile install, dependency pin check, and repository lint completed successfully.

Verify the production build in a browser

Run these commands from the repository root with Node.js 24 and the pinned pnpm version.

pnpm install --frozen-lockfile
REDIS_URL=redis://localhost:6379 pnpm turbo run build --filter=web
REDIS_URL=redis://localhost:6379 pnpm --filter web start --hostname 127.0.0.1 --port 3162
  1. Open the local homepage and scroll to “Add an email editor to your product.”
  2. Double-click “block” in the “Try it!” paragraph.
  3. Confirm the floating formatting controls appear in a single horizontal toolbar with the theme background. Click B and check that the selected word becomes bold.

Homepage screenshots

Both captures show the selection of “block” in the homepage editor.

Before

Before the patch, the toolbar is transparent and the controls stack vertically

After

After the patch, the controls are in a horizontal toolbar with the theme background