From 4b224d5effda952d7d87b96dd30407178edf4115 Mon Sep 17 00:00:00 2001 From: Pedro Guzman Date: Mon, 30 Jun 2025 15:40:54 +0200 Subject: [PATCH] fix: fix onScroll in Select.Content (#12855) Radix' `Select.Content` is not the scrollable div. It's `Select.Viewport`, which we don't expose. onScroll is useful when the elements in the select are loaded in infinite loading style. Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com> --- .changeset/spotty-ears-end.md | 5 +++++ .../ui/src/components/select/select.tsx | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 .changeset/spotty-ears-end.md diff --git a/.changeset/spotty-ears-end.md b/.changeset/spotty-ears-end.md new file mode 100644 index 0000000000..3817cf2689 --- /dev/null +++ b/.changeset/spotty-ears-end.md @@ -0,0 +1,5 @@ +--- +"@medusajs/ui": patch +--- + +fix: fix onScroll in Select.Content diff --git a/packages/design-system/ui/src/components/select/select.tsx b/packages/design-system/ui/src/components/select/select.tsx index 918a97c528..5f7d39fbde 100644 --- a/packages/design-system/ui/src/components/select/select.tsx +++ b/packages/design-system/ui/src/components/select/select.tsx @@ -105,8 +105,8 @@ const Trigger = React.forwardRef< }) Trigger.displayName = "Select.Trigger" -interface SelectContentProps extends React.ComponentPropsWithoutRef { -} +interface SelectContentProps + extends React.ComponentPropsWithoutRef {} /** * The content that appears when the select is open. @@ -120,6 +120,7 @@ const Content = React.forwardRef< { className, children, + onScroll, /** * Whether to show the select items below (`popper`) or over (`item-aligned`) the select input. */ @@ -161,6 +162,7 @@ const Content = React.forwardRef< position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]" )} + onScroll={onScroll} > {children} @@ -201,7 +203,7 @@ const Item = React.forwardRef< (({ className, ...props }, ref) => ( ))