Skip to content

shadcn/ui Combobox not scrolling inside a Dialog

Fix a shadcn/ui Combobox or Popover inside a Dialog: set modal={true} on Popover, stop wheel propagation on CommandList, and fix focus trapping.

Updated 3 December 2026Tested with
  • shadcn 4.23.0
  • Tailwind CSS 4.3.5
  • Vite 8
  • React 19.3

Put a shadcn/ui Combobox (built from Popover + Command) inside a Dialog or Sheet and two things break: the mouse wheel refuses to scroll the option list, and clicking an option either fails or closes the parent dialog. Both happen because Radix Dialog locks body scroll and traps focus while Popover defaults to non-modal.

The two-line fix

  1. Step 2: Stop wheel propagation if scroll still locks on macOS

    If your DialogContent itself has overflow-y-auto, some browsers still swallow trackpad events on the inner list. Add onWheel={(e) => e.stopPropagation()} and onTouchMove={(e) => e.stopPropagation()} to CommandList:

    command-list.tsxTSX
    <CommandList  className="max-h-60 overflow-y-auto"  onWheel={(e) => e.stopPropagation()}  onTouchMove={(e) => e.stopPropagation()}>

Two other causes inside Dialogs

  • Popover opens behind the Dialog: Check the z-index in components/ui/popover.tsx and dialog.tsx. Both default to z-50; because the popover portal mounts after the dialog, it usually stacks on top, unless a custom wrapper gives the dialog z-[60].
  • Typing in CommandInput loses focus: Make sure the PopoverContent is rendered inside the Dialog tree (not hoisted outside by a custom portal container) so Radix's focus scope recognizes the input as part of the active dialog.

Questions

Does Base UI have the same Combobox-in-Dialog problem?

Less often: Base UI ships a first-class Combobox primitive that coordinates with its own Dialog portal. See shadcn/ui Base UI vs Radix for the trade-offs.

Why does Escape close both the Popover and the Dialog?

Without modal={true} on the Popover, both layers can receive the Escape keydown. With modal={true}, the first Escape closes only the Popover and the second closes the Dialog.

Was this page helpful?

Still stuck? We answer every message ourselves. Write to us

Building with shadcn/ui and Tailwind CSS v4?

Install 188 free blocks and components with the shadcn CLI (no account), preview them in your own brand in Studio, or get all 1,570 blocks and every theme in UI Pro (€199 once).

Use it with

This page is built from UI Pro parts: the docs article block (docs-quernly) with the code, terminal, install command, steps, contents and feedback components, included in UI Pro.