Skip to content

fix(ui): resolve CommandDialog crash on CMD/CTRL + J shortcut#4761

Merged
Siumauricio merged 1 commit into
Dokploy:canaryfrom
imrja8:fix/command-dialog-crash
Jul 7, 2026
Merged

fix(ui): resolve CommandDialog crash on CMD/CTRL + J shortcut#4761
Siumauricio merged 1 commit into
Dokploy:canaryfrom
imrja8:fix/command-dialog-crash

Conversation

@imrja8

@imrja8 imrja8 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What is this PR about?

This PR fixes a critical regression introduced in v0.29.10 where users attempting to open the global search palette (via the ⌘J or Ctrl+J shortcut) would encounter a complete page crash resulting in a 400 error screen and a runtime TypeError.

The recent shadcn/ui / Tailwind v4 update (PR #4706) unintentionally broke the DOM structure and state context of the CommandDialog component. This PR completely resolves the crash while strictly adhering to the new Tailwind v4 design patterns.

How & Why

1. Fixed Radix UI Portal Rendering Crash (400 Error)

  • The Bug: In the CommandDialog component rewrite, the <DialogHeader> (which contains the <DialogTitle> and <DialogDescription>) was placed outside of the <DialogContent> wrapper. This invalid DOM structure broke the Radix UI accessibility constraints and portal rendering logic, causing Next.js to throw a fatal rendering error that triggered the _error.tsx 400 page.
  • The Fix: Moved the <DialogHeader> back inside the <DialogContent> boundary where Radix UI expects it to be mounted.

2. Fixed cmdk Subscribe TypeError

  • The Bug: The rewrite accidentally deleted the root <Command> wrapper from inside CommandDialog. Because the SearchCommand component renders sub-components (like CommandInput and CommandList) as children of the dialog, these sub-components failed to find the cmdk context provider. Upon mounting, they attempted to .subscribe() to an undefined store, resulting in a fatal runtime JavaScript error.
  • The Fix: Restored the root <Command> wrapper inside CommandDialog to properly initialize the cmdk state store for its children.

Intentional Optimizations & Architecture Decisions

  • Contextual Styling via Tailwind v4 Variants: Previously, the CommandDialog relied on a massive inline string of deeply nested CSS selectors (e.g., [&_[cmdk-input]]:h-12) injected from the parent to override the styles of the command palette. This was brittle and broke component cohesion.
  • Cleaned Component Architecture: I entirely removed the injected parent styling string. Instead, I migrated the overrides directly into the individual components (CommandItem, CommandInput, CommandGroup) utilizing Tailwind v4's modern in-* contextual variants.
  • Targeted Scope: By using in-data-[slot=dialog-content], these components now dynamically apply the larger paddings and icon sizes only when rendered inside a modal dialog. This perfectly preserves the compact styling of standard dropdowns and comboboxes (which use PopoverContent) elsewhere in the application, ensuring zero negative blast radius.

Checklist

Before submitting this PR, please make sure that:

  • You created a dedicated branch based on the canary branch.
  • You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
  • You have tested this PR in your local instance. If you have not tested it yet, please do so before submitting. This helps avoid wasting maintainers' time reviewing code that has not been verified by you.

Issues related

closes #4756

Changes Verified

Yes

Screenshots

NA

@imrja8 imrja8 requested a review from Siumauricio as a code owner July 7, 2026 15:54
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jul 7, 2026
@Siumauricio Siumauricio merged commit 98b8630 into Dokploy:canary Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web Pages Crash After Accidentally Pressing Command + J on Mac

2 participants