Skip to content

fix: styles and e2e assumptions that relied on menus being nested in their trigger - #3057

Closed
YousefED wants to merge 4 commits into
portals-cleanup-v2from
portals-e2e-fixes
Closed

fix: styles and e2e assumptions that relied on menus being nested in their trigger#3057
YousefED wants to merge 4 commits into
portals-cleanup-v2from
portals-e2e-fixes

Conversation

@YousefED

@YousefED YousefED commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #3052 (always-pass portalElement): menus and popovers are portalled into the editor container, so three things that assumed they were DOM descendants of their trigger stopped holding.

  • Mantine styles: the 12px / 30px menu items were scoped through .bn-toolbar / .bn-side-menu; now scoped on the dropdowns' own classes (.bn-select, .bn-menu-dropdown, .bn-table-handle-menu, .bn-drag-handle-menu). Measured identical computed styles to mobile-toolbar-demo (font, height, hover colour, padding, position, min-width).
  • Ariakit stacking: Ariakit pins menus/popovers at z-index: 50; as siblings of the UI controllers' wrappers (--bn-ui-base-z-index + 10…90) the drag handle painted over the colors submenu. They now sit at base + 100. Mantine already uses 300; shadcn's vendored z-50 has the same numbers but no placement that overlaps today (left as is).
  • e2e: userEvent.click releases within the same tick, which loses a mousedown/click focus race against the mantine toolbar's focus trap that no real press (≥ ~40 ms) can lose; the affected tests now click through a helper that holds the button. The drag handle menu selector matches the menu by its own class.

Verified in Docker (chromium): ariakit, shadcn, comments, colors, draghandle and theming suites, 45/45.

Menus and popovers are portalled into the editor container, so they are
no longer descendants of the toolbar, side menu or table handle that
opens them. Rules scoped through those ancestors stopped applying:

- mantine: the 12px / 30px menu items (block type select, color menus,
  drag handle menu, table handle menu, comment actions) are now scoped on
  the dropdowns' own classes; the drag handle menu keeps its min-width.
  The `padding` and `position` it also set are already provided by the
  base dropdown rule and Mantine's own stylesheet, and the hover colour
  by the base item rule.
- ariakit: menus and popovers get a z-index above the UI controllers'
  wrappers (`--bn-ui-base-z-index` + 10…90). Ariakit's stylesheet pins
  them at 50, which inline was inside the side menu's stacking context but
  as a sibling paints the drag handle over the colors submenu. The toolbar
  gap rule is dropped; it was not needed.
…enu by class

Two e2e assumptions broke with portalled popovers:

- `userEvent.click` releases the button within the same tick. The mantine
  toolbar's focus trap arms on mousedown and moves focus in a `setTimeout`;
  with a 0 ms press that lands after the link form's input has autofocused
  and steals focus back, so typing goes nowhere. Any real press (≥ ~40 ms)
  lets the input win, which is why it never reproduces manually. Add a
  `delay` to the positional mouse click and a `clickElement` helper that
  holds the button, and use it where a form popover is opened and typed
  into right away.
- The drag handle menu is no longer a child of `.bn-side-menu`; match it
  by its own class.
@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
blocknote Ready Ready Preview Sep 5, 2026 4:35pm UTC
blocknote-website Ready Ready Preview Sep 5, 2026 4:35pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Sep 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/ariakit@3057

@blocknote/code-block

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/code-block@3057

@blocknote/core

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/core@3057

@blocknote/diagram-block

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/diagram-block@3057

@blocknote/mantine

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/mantine@3057

@blocknote/math-block

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/math-block@3057

@blocknote/react

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/react@3057

@blocknote/server-util

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/server-util@3057

@blocknote/shadcn

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/shadcn@3057

@blocknote/xl-ai

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-ai@3057

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-docx-exporter@3057

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-email-exporter@3057

@blocknote/xl-multi-column

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-multi-column@3057

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-odt-exporter@3057

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-pdf-exporter@3057

@blocknote/xl-typst-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-typst-exporter@3057

commit: ea4042d

Mounting schedules an update from an effect that can commit after `act`
has returned. On Linux WebKit whether it does varies from mount to mount,
so the setup measured second sometimes counted one commit fewer or more
than the baseline and the comparison failed (CI's webkit shard, 1 of 3
runs locally in Docker). Wait until no commit has landed for 50 ms before
reading the counts, at mount and after the parent re-render, so every
mount is measured once things have settled.
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://TypeCellOS.github.io/BlockNote/pr-preview/pr-3057/

Built to branch gh-pages at 2026-09-05 16:42 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

The removed toolbar gap rule also spaced the two fields of the edit-link
form. Restore that for form popovers only, so lists keep the tighter
spacing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant