Skip to content

fix(desktop): use Tailwind v4 (--var) syntax for Radix CSS variables - #985

Draft
h4yfans wants to merge 1 commit into
mainfrom
fix/tailwind-v4-radix-css-var-classes
Draft

fix(desktop): use Tailwind v4 (--var) syntax for Radix CSS variables#985
h4yfans wants to merge 1 commit into
mainfrom
fix/tailwind-v4-radix-css-var-classes

Conversation

@h4yfans

@h4yfans h4yfans commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Tailwind v4 removed v3's implicit var() wrapping inside square-bracket arbitrary values. A class like w-[--radix-dropdown-menu-trigger-width] now compiles to:

width: --radix-dropdown-menu-trigger-width;  /* bare custom-property name where a length belongs */

That is invalid CSS, so the browser drops the declaration entirely and the class silently does nothing. Verified by compiling through the workspace's own Tailwind:

Source Compiles to
w-[--x] width: --x invalid, dropped
w-(--x) width: var(--x) correct
w-[var(--x)] width: var(--x) also correct

This converts all nine remaining instances in apps/desktop/src/renderer/src to the v4 (--var) shorthand. components/ui/context-menu.tsx already used that form and served as the style reference.

Real layout impact — the floating element never matched its trigger width:

  • components/nav-user.tsxw-(--radix-dropdown-menu-trigger-width)
  • components/team-switcher.tsx — same
  • components/ui/picker/picker-content.tsxw-(--radix-popover-trigger-width); the width="trigger" prop was a no-op until now
  • components/ui/select.tsxmax-h-(--radix-select-content-available-height); long select menus had no viewport height cap

Animation origin silently fell back to center instead of the popper-anchored corner:

  • components/ui/dropdown-menu.tsx (2 instances), select.tsx, popover.tsx, hover-card.tsx, tooltip.tsx

Note for reviewers

Two changes fall outside the strict scope, both flagged deliberately:

  1. select.tsx max-h- — the brief listed eight instances and said the max-h- ones were already fixed. One was not: max-h-[--radix-select-content-available-height] sits on the same line as the origin class in select.tsx:69. Same bug class, and the verification grep still flagged it, so it is fixed here.
  2. team-switcher.tsx text-lefttext-start, ml-automs-auto — pre-existing physical Tailwind classes, unrelated to this fix. The pre-commit renderer guard scans whole staged files rather than changed lines, so touching the file requires clearing them. Both conversions are RTL-correct.

No behavior is gated or changed beyond CSS that previously did not apply. Purely additive to what the browser actually renders — no migration or compat concern.

Release note

Dropdown and popover menus now correctly match the width of the control that opens them, and open/close animations anchor to the right corner instead of scaling from the center.

Test plan

  • grep -rnE "[a-z0-9-]+-\[--[a-z0-9-]+\]" apps/desktop/src/renderer — no matches remain (exit 1)
  • pnpm --filter @memry/desktop typecheck:web — clean
  • pnpm --filter @memry/desktop test:renderer — 559 files, 6301 passed, 6 skipped, 0 failed

Tailwind v4 removed v3's implicit var() wrapping inside square-bracket
arbitrary values, so `w-[--radix-popover-trigger-width]` now compiles to
`width: --radix-popover-trigger-width` — a bare custom-property name where
a length belongs. That is invalid CSS, so the browser drops the whole
declaration and the class silently does nothing.

Converted all nine remaining instances to the v4 `(--var)` shorthand,
matching context-menu.tsx which already used the correct form.

Real layout impact — dropdown/popover no longer matches its trigger width:
- nav-user.tsx, team-switcher.tsx: w-(--radix-dropdown-menu-trigger-width)
- picker-content.tsx: w-(--radix-popover-trigger-width); the `width="trigger"`
  prop was a no-op until now
- select.tsx: max-h-(--radix-select-content-available-height); long select
  menus had no viewport height cap

Animation origin fell back to `center` instead of the popper-anchored corner:
- dropdown-menu.tsx (x2), select.tsx, popover.tsx, hover-card.tsx, tooltip.tsx

Also converts two pre-existing physical Tailwind classes in team-switcher.tsx
(text-left -> text-start, ml-auto -> ms-auto) — the pre-commit renderer guard
scans whole staged files, so touching the file requires clearing them.

Verified: grep for the v3 pattern returns no matches, typecheck:web clean,
test:renderer 559 files / 6301 passed.
@github-actions github-actions Bot added the bug Something isn't working label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 862b499.

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant