Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

Fix popover dropdowns scrolling in Drawers/Dialogs (#921)

Chase Foster6b7a788fd98a
diff --git a/llm/cache/coding-conventions.md b/llm/cache/coding-conventions.md
index b3dc056668..0e08abefbb 100644
--- a/llm/cache/coding-conventions.md
+++ b/llm/cache/coding-conventions.md
@@ -129,6 +129,27 @@ const { client, companyId, userId } = await requirePermissions(request, {
- Accessibility considerations (ARIA attributes)
- Dark mode support via theme system
+### Popover dropdowns inside Drawers/Dialogs must stop wheel propagation
+
+`Combobox`, `CreatableCombobox`, `CreatableMultiSelect`, `MultiSelect`, and
+`ChoiceSelect` (all in `packages/react/src/`) render their options list in a
+`PopoverContent` portaled to `document.body`. The `Drawer` (`Drawer.tsx`) is a
+Radix Dialog, which uses `react-remove-scroll` to lock background scrolling.
+Because the popover is portaled outside the dialog subtree, the scroll-lock's
+document-level wheel listener intercepts wheel/touch events over the dropdown
+and the list's internal `overflow-auto` container cannot scroll (symptom: the
+dropdown shows only the first ~6 options and won't scroll).
+
+Fix/required pattern: add `onWheel={(e) => e.stopPropagation()}` and
+`onTouchMove={(e) => e.stopPropagation()}` to the `PopoverContent` so the event
+never reaches the scroll-lock listener. Any new popover-based dropdown with an
+internal scroll area used inside a drawer/dialog must follow this pattern.
+
+The list's scroll container should also carry
+`scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent` (tailwind
+scrollbar plugin) so a draggable scrollbar is visible even on platforms with
+overlay scrollbars (macOS). All four dropdowns now use these classes.
+
## Theme System
Themes are defined in `packages/utils/src/themes.ts` with CSS variables for colors. The user's selected theme is stored in the database and accessed via the `useTheme()` hook in `apps/erp/app/hooks/useTheme.tsx`.
diff --git a/packages/react/src/Combobox.tsx b/packages/react/src/Combobox.tsx
index 2bad7ce1dd..5fe93b4656 100644
--- a/packages/react/src/Combobox.tsx
+++ b/packages/react/src/Combobox.tsx
@@ -154,6 +154,8 @@ const Combobox = forwardRef<HTMLButtonElement, ComboboxProps>(
</PopoverTrigger>
<PopoverContent
align="start"
+ onWheel={(e) => e.stopPropagation()}
+ onTouchMove={(e) => e.stopPropagation()}
className="min-w-[var(--radix-popover-trigger-width)] max-w-[min(560px,calc(100vw-2rem))] p-1"
style={{
width: dropdownContentWidthCh
diff --git a/packages/react/src/CreateableCombobox.tsx b/packages/react/src/CreateableCombobox.tsx
index 912f09d665..6a2f36a400 100644
--- a/packages/react/src/CreateableCombobox.tsx
+++ b/packages/react/src/CreateableCombobox.tsx
@@ -162,6 +162,8 @@ const CreatableCombobox = forwardRef<HTMLButtonElement, CreatableComboboxProps>(
</PopoverTrigger>
<PopoverContent
align="start"
+ onWheel={(e) => e.stopPropagation()}
+ onTouchMove={(e) => e.stopPropagation()}
className="min-w-[var(--radix-popover-trigger-width)] max-w-[min(560px,calc(100vw-2rem))] p-1"
style={{
width: dropdownContentWidthCh
diff --git a/packages/react/src/CreateableMultiSelect.tsx b/packages/react/src/CreateableMultiSelect.tsx
index 54f5d8fe73..8851b05573 100644
--- a/packages/react/src/CreateableMultiSelect.tsx
+++ b/packages/react/src/CreateableMultiSelect.tsx
@@ -185,6 +185,8 @@ const CreatableMultiSelect = forwardRef<
</PopoverTrigger>
<PopoverContent
align="end"
+ onWheel={(e) => e.stopPropagation()}
+ onTouchMove={(e) => e.stopPropagation()}
className="min-w-[var(--radix-popover-trigger-width)] max-w-[min(560px,calc(100vw-2rem))] p-1"
style={{
width: dropdownContentWidthCh
@@ -296,7 +298,7 @@ function VirtualizedCommand({
/>
<div
ref={parentRef}
- className="overflow-auto pt-1"
+ className="overflow-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent pt-1"
style={{
height: `${Math.min(filteredOptions.length, 6) * itemHeight + 4}px`
}}
diff --git a/packages/react/src/MultiSelect.tsx b/packages/react/src/MultiSelect.tsx
index 84d2abd6f8..7778f0aa1e 100644
--- a/packages/react/src/MultiSelect.tsx
+++ b/packages/react/src/MultiSelect.tsx
@@ -186,6 +186,8 @@ const MultiSelect = forwardRef<HTMLButtonElement, MultiSelectProps>(
</PopoverTrigger>
<PopoverContent
align="end"
+ onWheel={(e) => e.stopPropagation()}
+ onTouchMove={(e) => e.stopPropagation()}
className="min-w-[var(--radix-popover-trigger-width)] p-1"
>
<VirtualizedCommand
@@ -271,7 +273,7 @@ function VirtualizedCommand({
<CommandEmpty>{t`No option found.`}</CommandEmpty>
<div
ref={parentRef}
- className="overflow-auto pt-1"
+ className="overflow-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent pt-1"
style={{
height: `${Math.min(filteredOptions.length, 6) * itemHeight + 4}px`
}}