From 882f59b24d006ef5c42aa4f9f334b7af7b94b3b3 Mon Sep 17 00:00:00 2001 From: MananTank Date: Wed, 6 Nov 2024 16:37:51 +0000 Subject: [PATCH] Fix Select selection not working on mobile device - radix fix no longer required (#5321) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem solved Short description of the bug fixed or feature added --- ## PR-Codex overview This PR focuses on simplifying the `ref` handling in the `SelectPrimitive.Content` component of the `select.tsx` file by removing a custom `ref` function and replacing it with a direct assignment. It also enhances the component's class names for better styling based on its state. ### Detailed summary - Removed custom `ref` handling logic. - Directly assigned `ref` to `SelectPrimitive.Content`. - Updated `className` with various state-based styles for animations and positioning. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- apps/dashboard/src/@/components/ui/select.tsx | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/apps/dashboard/src/@/components/ui/select.tsx b/apps/dashboard/src/@/components/ui/select.tsx index 460d5b90420..e458a21fff3 100644 --- a/apps/dashboard/src/@/components/ui/select.tsx +++ b/apps/dashboard/src/@/components/ui/select.tsx @@ -73,19 +73,7 @@ const SelectContent = React.forwardRef< >(({ className, children, position = "popper", ...props }, ref) => ( { - if (typeof ref === "function") { - ref(instance); - } else if (ref) { - ref.current = instance; - } - if (!instance) return; - - instance.ontouchstart = (e) => { - e.preventDefault(); - }; - }} + ref={ref} className={cn( "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md data-[state=closed]:animate-out data-[state=open]:animate-in", position === "popper" &&