Opening shadcn dialog resets scroll to top #565
Replies: 4 comments 6 replies
-
I'm not certain what is triggering the scroll reset. Can you determine what's triggering the reset? |
Beta Was this translation helpful? Give feedback.
-
I ran into this issue with DropdownMenus. It's because the epic-stack's app is styled to have a fixed height. My app does not need a fixed height. Swapping |
Beta Was this translation helpful? Give feedback.
-
With Dropdown Menu & Select, I saw that there are issues within the primitives in Radix UI that cause this. In fact I had to migrate to using Dropdown Menu instead of select because of it. Anyways, in those scenarios, and specifically with Dropdown Menu, the way to fix it was to set |
Beta Was this translation helpful? Give feedback.
-
В моем случае диалоговое окно открывалось через Link на карточке товара и тоже был скролл в начало страницы, при закрытии скролилось обратно к карточке. Решение нашлось путем добавления к Link scroll={false}. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm losing scroll position after adding the shadcn dialog and opening it, should this be expected to work? Could be related to #346
Steps
npx create-epic-app@latest
npm install lucide-react
(for shadcn dialog)npx shadcn-ui@latest add dialog
Expected
Dialog opens and the scroll position is preserved
Actual
Dialog opens but scroll position resets to the top
In this repo I've done that, the only change to the initial template are the shadcn dialog bits: https://github.com/WillSmithTE/dialog-scroll
dialog-scroll-reset.mov
Beta Was this translation helpful? Give feedback.
All reactions