ui icon indicating copy to clipboard operation
ui copied to clipboard

[bug]: Select content breaking the page structure

Open SamuelPires1999 opened this issue 2 years ago • 16 comments

When using the select component, opening the select content completely breaks the entire page, and I don't know if the problem is actually the component itself or if I forgot something when implementing it.

the code for it is the following:

       <Select>
          <SelectTrigger className="w-full">
            <SelectValue placeholder="Select" />
          </SelectTrigger>
          <SelectContent>
            <SelectItem value="DEPRIVED">Deprived</SelectItem>
            <SelectItem value="KNIGHT">Knight</SelectItem>
            <SelectItem value="MAGE">Mage</SelectItem>
            <SelectItem value="CLERIC">Cleric</SelectItem>
            <SelectItem value="ARCHER">Archer</SelectItem>
          </SelectContent>
        </Select>

And this is the behavior that I get when clicking the trigger.

Screenshot 2023-03-02 at 15 19 41 Screenshot 2023-03-02 at 15 20 00

SamuelPires1999 avatar Mar 02 '23 18:03 SamuelPires1999

Note that the same happens with the Dialog component, its the exact same behavior

SamuelPires1999 avatar Mar 02 '23 18:03 SamuelPires1999

Let me see if I can reproduce this. This is a <Select /> and <Dialog /> on the same page?

shadcn avatar Mar 10 '23 11:03 shadcn

Sorry if Im late for the reply, but no, the image shows only the select bug, but dialog does the exact same effect.

SamuelPires1999 avatar Mar 15 '23 20:03 SamuelPires1999

@shadcn This happens even on the docs page Animation

stormynight9 avatar Apr 05 '23 20:04 stormynight9

+1

Any updates?

jeffminsungkim avatar May 05 '23 09:05 jeffminsungkim

+1

alexjoedt avatar Jul 12 '23 17:07 alexjoedt

Can you help me reproduce this? Here's a CodeSandbox link: https://codesandbox.io/p/sandbox/github/shadcn/next-template-debug/tree/main

shadcn avatar Jul 13 '23 06:07 shadcn

Hey @shadcn, unfortunately I could not reproduce the error in your sandbox, but i could in my own and i found out where the error comes from.

EDIT: I am using react with vite

In my case i have a PanelGroup (from react-resizable-panels) where i set the position: absolute;. When i remove the position property, the Select works fine. Furthermore, when i leave position: absolute in my PanelGroup and add following props tho the body element it works also fine.

body {
  position: relative;
  min-height: 100vh;
}

Sandbox See main.tsx and app.module.css

Thank you!

alexjoedt avatar Jul 13 '23 09:07 alexjoedt

I also got some unwanted result when using Select inside Dialog, the hover effect are gone

lucasjinreal avatar Sep 04 '23 03:09 lucasjinreal

i also got the same issue, dialog + select = ui bug

AbyerAli avatar Sep 29 '23 18:09 AbyerAli

Same issue here: Dialog + Select.

aidrecabrera avatar Dec 19 '23 22:12 aidrecabrera

Specifying max-width and margin: auto to body would reproduce this.

dkjym avatar Dec 31 '23 02:12 dkjym

in my case it's because I had mx-auto on body, to solve it I created a div inside the body and added mx-auto there.

vivekascoder avatar Jan 16 '24 12:01 vivekascoder

I had the same issue @vivekascoder, but using Dropdown Menu, thanks for sharing the resolution!

erickcestari avatar Jan 18 '24 00:01 erickcestari

thanks @vivekascoder worked for me

chrisblakely01 avatar Mar 13 '24 10:03 chrisblakely01

+1

Sagbyy avatar Jun 07 '24 21:06 Sagbyy

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

shadcn avatar Jul 10 '24 23:07 shadcn