breadadams / scroller-motion

🛹 Elegant motion scrolling for React

Home Page:https://scroller-motion.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Height and width isn't recalculated if children change

MrUltimate opened this issue · comments

Hey there,

I might be missing something but it seems like the height and width aren't recalculated if the content changes. For example, on my project archive page, I have filters that change the height of the content. In this case, the expected behavior should be that the height of the scroll bar should change based off of the new height. This however isn't the case. I've attached a video below for you if that helps. Happy to share more as needed. Is there a way to force scroller-motion to recalculate the scroll height/width?

Export.Jan.31.2023.1151.PM.mp4

Hey @MrUltimate, that's strange as the size should be being recalculated on both window resize and when the inner element's size changes via the ResizeObserver API (you'll see this working in the examples by clicking on the colored blocks).

It might be due to how that height change is happening in your app, if you could provide a simple reproduction I'll take a look.

Is there a way to force scroller-motion to recalculate the scroll height/width?

For this there's nothing "official", however since the window resize event is being used as mentioned above, you should be able to force a size calculation by firing the event manually, with something like window.dispatchEvent(new Event('resize')).

Thanks @breadadams, it was indeed something wrong with my CSS. I apologize for making all these issues, I think it might be time to take a CSS course 😅