ui icon indicating copy to clipboard operation
ui copied to clipboard

How to to make sheet open but inside dropdown menu

Open victormongi opened this issue 2 years ago • 2 comments
trafficstars

How to to make sheet open but inside dropdown menu? Im trying but the sheet imidietly close. thank you.

victormongi avatar Oct 06 '23 01:10 victormongi

Hello, I had the same issue and I fixed it by changing the <Sheet> root component to the top of the <DropdownMenu> component.

Don't forget to add the modal={false} to the <DropdownMenu> or the Sheet will toggle "pointer-events:none;" on <body> and the page will not have events after closing the sheet

<Sheet>
        <DropdownMenu modal={false}>
          <DropdownMenuTrigger>
            <>
              <span className="sr-only">Open menu</span>
              <MoreHorizontal className="h-4 w-4" />
            </>
          </DropdownMenuTrigger>
          <DropdownMenuContent align="end" className="p-2">
            <DropdownMenuLabel>Actions</DropdownMenuLabel>
            <DropdownMenuItem>
              <SheetTrigger>Edit</SheetTrigger>
            </DropdownMenuItem>
          </DropdownMenuContent>
        </DropdownMenu>
        <SheetContent>...</SheetContent>
      </Sheet>

floriaaan avatar Oct 08 '23 14:10 floriaaan

Got somewhat the same issue when trying to trigger a modal when a dropdown element was "active", this triggered "pointer-events:none;" on body. Applied modal={false} and fixed the problem!

Nice, thanks Floriaaan!

Andi365 avatar Oct 11 '23 11:10 Andi365

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 Feb 25 '24 23:02 shadcn

Any idea how can i have a dropdownmenu with two or more options, and each option open a different sheet modal? For example: when clicking on options it triggers the dropdownmenu which has: 1. new incidence, 2. edit selected incidence, 3. modify status. Each option should trigger different sheets forms.

Acapovilladev avatar Mar 23 '24 04:03 Acapovilladev

@Acapovilladev did you figure this out? facing the same issue

hqasmei avatar May 08 '24 17:05 hqasmei

im having the same issue opening a sheet from a dropdown menu item. sheet closes automatically

kasvith avatar May 23 '24 17:05 kasvith

@Acapovilladev did you solve it? I also would like to open different sheets based dropdown menu item selected.

viniciuscolodetti avatar Jul 30 '24 20:07 viniciuscolodetti

I solved the problem of open different sheets using a popover instead of dropdown menu.

The single problem is the popover don't close on open the sheet

viniciuscolodetti avatar Jul 31 '24 11:07 viniciuscolodetti