ui: Bug(DropdownMenu): Margin shift when opening dropdown menu

When I open DropdownMenu, a weird shift is triggered. However, when I close it, it disappears.

When it’s closed: Screenshot 2023-12-29 191515 When it’s opened: Screenshot 2023-12-29 191527

I have no idea what could cause this.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16

Most upvoted comments

I’m having the same issue. Setting modal=false to the dropdown menu component fixes the issue for me.

<DropdownMenu modal={false}>
   ...
</DropdownMenu>

modal={false} fixes it.

I’m having the same issue. Setting modal=false to the dropdown menu component fixes the issue for me.

<DropdownMenu modal={false}>
   ...
</DropdownMenu>

Thanks a lots

So this is indeed still an issue. Maybe relevant that my navbar is using Tailwind’s fixed and top left right set to 0.

modal={false} also confirmed to fix. Maybe some conflict with fixed elements? I imagine OP’s navbar may have been fixed as well.

Video attached if possible.

https://github.com/user-attachments/assets/b7de0cba-e0b9-4e97-9b77-73b1b60d76c5

Recommend reopening issue.

Using chadcn-svelte I did the following to make it work: DropdownMenu.Root preventScroll={false}