fix(desktop): use Tailwind v4 (--var) syntax for Radix CSS variables - #985
Draft
h4yfans wants to merge 1 commit into
Draft
fix(desktop): use Tailwind v4 (--var) syntax for Radix CSS variables#985h4yfans wants to merge 1 commit into
h4yfans wants to merge 1 commit into
Conversation
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.
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tailwind v4 removed v3's implicit
var()wrapping inside square-bracket arbitrary values. A class likew-[--radix-dropdown-menu-trigger-width]now compiles to: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:
w-[--x]width: --xw-(--x)width: var(--x)w-[var(--x)]width: var(--x)This converts all nine remaining instances in
apps/desktop/src/renderer/srcto the v4(--var)shorthand.components/ui/context-menu.tsxalready used that form and served as the style reference.Real layout impact — the floating element never matched its trigger width:
components/nav-user.tsx—w-(--radix-dropdown-menu-trigger-width)components/team-switcher.tsx— samecomponents/ui/picker/picker-content.tsx—w-(--radix-popover-trigger-width); thewidth="trigger"prop was a no-op until nowcomponents/ui/select.tsx—max-h-(--radix-select-content-available-height); long select menus had no viewport height capAnimation origin silently fell back to
centerinstead of the popper-anchored corner:components/ui/dropdown-menu.tsx(2 instances),select.tsx,popover.tsx,hover-card.tsx,tooltip.tsxNote for reviewers
Two changes fall outside the strict scope, both flagged deliberately:
select.tsxmax-h-— the brief listed eight instances and said themax-h-ones were already fixed. One was not:max-h-[--radix-select-content-available-height]sits on the same line as the origin class inselect.tsx:69. Same bug class, and the verification grep still flagged it, so it is fixed here.team-switcher.tsxtext-left→text-start,ml-auto→ms-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— cleanpnpm --filter @memry/desktop test:renderer— 559 files, 6301 passed, 6 skipped, 0 failed