Skip to content

fix(ui): mark DropdownMenu/ContextMenu/Menubar portals non-translatable - #5214

Merged
pedrofrxncx merged 1 commit into
mainfrom
fix/notranslate-menu-portals-w4
Jul 24, 2026
Merged

fix(ui): mark DropdownMenu/ContextMenu/Menubar portals non-translatable#5214
pedrofrxncx merged 1 commit into
mainfrom
fix/notranslate-menu-portals-w4

Conversation

@pedrofrxncx

@pedrofrxncx pedrofrxncx commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Follows #5204, which fixed Select hard-crashing (NotFoundError: Failed to execute 'removeChild' on 'Node') when a browser's page-translation feature (Chrome Translate, etc.) rewrites text nodes inside a Radix portal — React's next unmount/reconcile then tries to remove a node translation already mutated and throws. That PR's own root-cause writeup cites this as "a known, well-documented class of bug — not specific to how Select is used here" (radix-ui/primitives#3795, #2578; react/react#11538).

DropdownMenu, ContextMenu, and Menubar (packages/ui/src/components/{dropdown-menu,context-menu,menubar}.tsx) share the exact same Portal + Content/SubContent shape as SelectContent, and render the same kind of short technical-label list items (not prose) — so they're equally exposed to the same non-deterministic crash whenever a user has browser translation active, and the same trade-off reasoning from #5204 (short technical labels, not machine-translatable prose) applies unchanged. This applies the identical translate="no" attribute + notranslate class fix already shipped for Select to their Content/SubContent, closing the gap left in these three sibling components.

Behavior-preserving style-only change (adds an attribute + a Tailwind/DOM notranslate class to each portaled content element) — no logic touched, no test existed for the analogous select.tsx fix either.

How to verify: open any DropdownMenu/ContextMenu/Menubar in the app with Chrome's "Translate this page" turned on and confirm no crash on open/close (mirrors the manual test plan in #5204).

Local checks: bun run fmt (clean) and bunx tsc --noEmit scoped to the touched files show no new errors (pre-existing unrelated errors from a stale apps/web/src/views/virtual-mcp directory are untouched by this diff). Full CI validates the rest.


Summary by cubic

Prevents crashes in portaled menus when browser translation is enabled by marking DropdownMenu, ContextMenu, and Menubar portal content as non-translatable. Mirrors the Select fix in #5204 with no behavior changes.

  • Bug Fixes
    • Add translate="no" and "notranslate" to portaled Content/SubContent in DropdownMenu, ContextMenu, and Menubar.
    • Avoids React NotFoundError when Chrome Translate mutates nodes inside Radix portals.

Written for commit 9948f9a. Summary will update on new commits.

Review in cubic

#5204 fixed Select crashing when a browser's page-translation feature
(Chrome Translate, etc.) mutates text nodes inside a Radix portal, causing
React's next unmount/reconcile to throw NotFoundError on removeChild — a
known class of bug (radix-ui/primitives#3795, react/react#11538), not
specific to Select.

DropdownMenu, ContextMenu, and Menubar share the exact same
Portal+Content/SubContent shape and short technical-label item content as
Select, so they're equally exposed. Applies the same translate="no" +
notranslate guard to their Content/SubContent, matching the fix already
shipped for Select.
@pedrofrxncx
pedrofrxncx enabled auto-merge (squash) July 24, 2026 17:48
@pedrofrxncx
pedrofrxncx merged commit 812516a into main Jul 24, 2026
14 checks passed
@pedrofrxncx
pedrofrxncx deleted the fix/notranslate-menu-portals-w4 branch July 24, 2026 17:57
decocms Bot pushed a commit that referenced this pull request Jul 24, 2026
PR: #5214 fix(ui): mark DropdownMenu/ContextMenu/Menubar portals non-translatable
Bump type: patch

- @deco/ui (packages/ui/package.json): 1.5.1 -> 1.5.2

Deploy-Scope: both
pedrofrxncx added a commit that referenced this pull request Jul 24, 2026
#5214 applied the translate="no" + notranslate guard (from #5204's Select fix
for the browser-translation removeChild crash) to DropdownMenu, ContextMenu,
and Menubar, reasoning that they share the exact same Portal+Content shape as
Select. Popover, HoverCard, and Tooltip share that identical shape too but
were left out — same crash surface, same fix.
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