Skip to content

fix(mantine): restore compact AI menu items - #3027

Draft
YousefED wants to merge 3 commits into
mainfrom
fix/ai-menu-small-item-height
Draft

fix(mantine): restore compact AI menu items#3027
YousefED wants to merge 3 commits into
mainfrom
fix/ai-menu-small-item-height

Conversation

@YousefED

@YousefED YousefED commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Every item in the AI menu — the prompt actions, and the Retry / Cancel error state — has been rendering at full suggestion-item height since v0.53.0.

Cause

#2909 (BLO-1192) changed the base item rule so items could grow to fit wrapped text:

 .bn-mantine .bn-suggestion-menu-item {
-  height: 52px;
+  min-height: 52px;
+  flex-shrink: 0;
 }

That rule also matches the small variant, which opted out with height: fit-content. That overrode the old fixed height, but does nothing against a min-height — min-height clamps the used height regardless.

So small items rendered at exactly the same 52px as full-size items, reducing size: "small" to a font-size change and a hidden subtitle:

BEFORE  small item: 52px   normal item: 52px
AFTER   small item: 30px   normal item: 52px

size: "small" is set in exactly one place in the repo (getDefaultAIMenuItems.tsx), so the AI menu absorbed all of it.

Fix

Declare the floor only on the items it's for, instead of setting it for everything and having the small rule try to undo it. A new size variant is now content-sized by default, rather than silently inheriting the clamp — which is how this bug happened.

height: fit-content goes with it: it only ever existed to beat the old fixed height.

The 52px floor itself is left alone. It predates this (#2033, originally height: 52px) and is closer to a design constant than a necessity: all 24 default slash menu items have a subtext, so they are naturally 49px and already uniform, and the floor only adds ~3px of padding plus alignment for custom items that omit subtext (47px). Dropping it is defensible, but it changes the look of every suggestion menu and churns baselines — a separate call from this regression fix.

flex-shrink: 0 stays on the base rule and is deliberately kept next to a comment explaining why, because it's coupled to the floor rather than decorative — in a height-constrained, scrolling menu:

item height
min-height: 52px + flex-shrink: 0 65.3px ✓ natural
min-height: 52px alone 52px ← squashed
flex-shrink: 0 alone 65.3px ✓
neither 65.3px ✓

A flex item defaults to min-height: auto, whose automatic minimum size already prevents shrinking below content. Writing an explicit min-height replaces auto and switches that off, so flex-shrink: 0 is what restores it — without it a wrapped item collapses back to 52px, re-creating the overflow BLO-1192 was about.

Mantine only. ariakit and shadcn never set a height on suggestion items.

Test

The AI menu had no coverage that could catch this. The one AI screenshot (ai_menu_scroll_position) is a document.body shot on an 800×400 viewport where the menu is clipped just below the first item — which is why #2909 only needed to update the slash menu baselines, and why no existing baseline moves in this PR either.

aiMenuAppearance.test.tsx screenshots the AI menu in its prompt and error states. Without the fix the menu is 88px taller, so both fail on all three browsers before pixels are even compared:

Expected image dimensions to be 623×200px, but received 623×288px.

Should this be ported to ariakit / shadcn?

No — checked, and they never had the bug.

The original report (#2744) shows Code Block's subtext wrapping to two lines with the second line spilling below the item's hover highlight. The overflow is vertical, and the cause is an item box that can't grow. Narrowing the menu until that subtext wraps, then measuring how far the text escapes its item:

skin item height text height text overflow below item
mantine, pre-#2909 (height: 52px) 52px 88px +43px ← the bug
mantine, current (min-height) 101px 88px −7px
ariakit 64px 48px −8px
shadcn 108px 96px −6px

Only the pinned height reproduces it. ariakit and shadcn let the row grow, so there is nothing to port.

Tooling

Two papercuts hit while regenerating baselines here, both in docker-run.sh:

  • -u swallows the filter. vitest declares the flag as -u, --update [type] — an optional value, which also accepts new/all/none. So in --run -u <filter>, cac reads the filter as the value of -u: the filter is dropped and the whole suite silently runs in update mode. e2e:updateSnaps ended in -u, so any filter appended to it (as CLAUDE.md instructs) landed in exactly that trap — it quietly rewrote an unrelated, flaky deleteShallowerBlock baseline to a wrong value during this work. Attaching the value as --update=true makes it unambiguous. vp run e2e:updateSnaps <filter> now runs 3 files instead of 156.
  • Double image build. wasm-pack emits xl-typst-compiler/pkg/package.json, which the image content hash globbed — so building the wasm that docker-run.sh itself requires invalidated the image. pkg is now pruned alongside dist.

Verification

Full suite green in Docker: 149 passed / 10 skipped (159 files), 890 tests, no snapshot churn beyond the six new baselines.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
blocknote Ready Ready Preview Aug 31, 2026 5:41pm
blocknote-website Ready Ready Preview Aug 31, 2026 5:41pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a8973f69-9f8d-45c0-9b15-dfdb8d29b2f2

📥 Commits

Reviewing files that changed from the base of the PR and between f0d80ae and 6b789cc.

⛔ Files ignored due to path filters (6)
  • tests/src/end-to-end/ai/__screenshots__/aiMenuAppearance.test.tsx/ai-menu-error-items-chromium-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/ai/__screenshots__/aiMenuAppearance.test.tsx/ai-menu-error-items-firefox-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/ai/__screenshots__/aiMenuAppearance.test.tsx/ai-menu-error-items-webkit-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/ai/__screenshots__/aiMenuAppearance.test.tsx/ai-menu-prompt-items-chromium-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/ai/__screenshots__/aiMenuAppearance.test.tsx/ai-menu-prompt-items-firefox-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/ai/__screenshots__/aiMenuAppearance.test.tsx/ai-menu-prompt-items-webkit-linux.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • .claude/skills/testing-skill/SKILL.md
  • packages/mantine/src/blocknoteStyles.css
  • tests/docker-run.sh
  • tests/src/end-to-end/ai/aiMenuAppearance.test.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change makes Mantine AI suggestion items fit their content, adds end-to-end coverage for prompt and error states, and updates screenshot test argument normalization and Docker image hashing.

Changes

AI menu appearance

Layer / File(s) Summary
Compact AI menu styling and coverage
packages/mantine/src/blocknoteStyles.css, tests/src/end-to-end/ai/aiMenuAppearance.test.tsx
AI menu items use min-height: fit-content. End-to-end tests verify compact classes, painted heights, prompt items, error items, and screenshots.
Screenshot runner argument and hash handling
tests/docker-run.sh, .claude/skills/testing-skill/SKILL.md
The script moves -u and --update after filters and excludes generated pkg/ paths from image hashing. The testing instructions document the argument behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 6b789

This PR restores compact AI menu item sizing in the Mantine theme and adds focused visual and behavioral coverage. No actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: nperez0111

Poem

A rabbit checks each menu row,
And trims the heights so snug they go.

The prompt appears, the error too,
Screenshots mark the work as true.
Flags hop last, while tests run bright.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the primary change: restoring compact AI menu items in the Mantine implementation.
Description check ✅ Passed The description is detailed and on-topic. It explains the regression, cause, fix, testing, tooling changes, scope, and verification results. It does not use the template headings or include the checkl…
Full details: Docstring Coverage

Explanation

Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. (2 skipped: 2 unsupported.)

Full details: Description check

Explanation

The description is detailed and on-topic. It explains the regression, cause, fix, testing, tooling changes, scope, and verification results. It does not use the template headings or include the checklist, but the required technical information is mostly complete.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ai-menu-small-item-height

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 Aug 31, 2026

Copy link
Copy Markdown

Open in StackBlitz

@blocknote/ariakit

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

@blocknote/code-block

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

@blocknote/core

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

@blocknote/diagram-block

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

@blocknote/mantine

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

@blocknote/math-block

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

@blocknote/react

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

@blocknote/server-util

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

@blocknote/shadcn

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

@blocknote/xl-ai

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

@blocknote/xl-docx-exporter

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

@blocknote/xl-email-exporter

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

@blocknote/xl-multi-column

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

@blocknote/xl-odt-exporter

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

@blocknote/xl-pdf-exporter

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

@blocknote/xl-typst-exporter

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

commit: 6cd9cd3

@github-actions

github-actions Bot commented Aug 31, 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-3027/

Built to branch gh-pages at 2026-08-31 17:48 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

#2909 changed `.bn-suggestion-menu-item` from `height: 52px` to
`min-height: 52px` so items could grow to fit wrapped text. But that rule
also matches the small variant, which opted out via `height: fit-content` -
which overrode the old fixed `height` and does nothing against a
`min-height`.

Small items therefore rendered at exactly the same 52px as full-size ones,
leaving `size: "small"` as a font-size change and a hidden subtitle. Every
default AI menu item is `size: "small"`, so the whole AI menu - prompt
actions and the Retry / Cancel error state - rendered stretched.

Declares the floor only on the items it is for, rather than setting it for
everything and having the small rule try to undo it. `height: fit-content`
goes with it: it only ever existed to beat the old fixed `height`. A new
size variant is now content-sized by default instead of silently inheriting
the clamp.

Mantine only: ariakit and shadcn never set a height on suggestion items.
The AI menu had no coverage that could catch this: the one AI screenshot
(`ai_menu_scroll_position`) is a `document.body` shot on an 800x400 viewport
where the menu is clipped just below the first item, which is why #2909 only
needed to update the *slash* menu baselines.

Screenshots the AI menu in its prompt and error states. Without the fix the
menu is 88px taller, so both fail on all three browsers before pixels are
even compared: "Expected image dimensions to be 623x200px, but received
623x288px".
…g twice

Two papercuts hit while regenerating baselines for the fix in this PR:

- vitest declares the flag as `-u, --update [type]` - an *optional* value,
  which also accepts `new`/`all`/`none`. So in `--run -u <filter>`, cac
  reads <filter> as the value of `-u`: the filter is dropped and the whole
  suite silently runs in update mode. `e2e:updateSnaps` ended in `-u`, so
  any filter a caller appends (as CLAUDE.md instructs) landed in exactly
  that trap - which quietly rewrote an unrelated, flaky
  `deleteShallowerBlock` baseline to a wrong value. Attaching the value as
  `--update=true` makes it unambiguous, so filters stay filters.

- wasm-pack emits `packages/xl-typst-compiler/pkg/package.json`, which the
  image content hash globbed, so building the wasm that docker-run.sh
  itself requires invalidated the image. A fresh clone paid two full image
  builds. `pkg` is now pruned alongside `dist`.
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