[BUG] Hiding header navigation causes menu item underline to start flying
1. Describe the bug
Currently working on a Next.js project.
I'm using <AnimatePresence> within _app.js to get page transition. Outside (above) of <AnimatePresence> block I include my <Header>. The header is fixed in its position, and when the user scrolls down it will hide using transform. Within the header there is also a set of page links with a <motion.div> being rendered for the current page / link. That <motion.div> is moving between the links based on which is currently active. It is all working fine as long as the user is scrolled up on the page and then clicks on a different page link.
However, if scrolled down, more than viewport (or next page height), and then clicks on a page link in the <Header> (that shows up if you scroll up a bit) then the underline <motion.div> starts animating from the far below of the page up to the new active page link.
If I turn of the "hiding" of my <Header> component, it seems to stay work as expected. I've tried hiding it by using "top" property, instead of transform, within my css, but same issue, the underline starts flying when navigating between pages.
2. Expected behavior
The <motion.div> underline should not start animating from somewhere else, it should just move between the page links horizontally, no vertical animation at all.
Same problem in React.js app. This especially occurs while scroll to top functionality is implemented on route changing.
Same issue here with Next 13
Still an issue..
Same issue here
It could be adding layout layoutRoot props to the position: fixed element helps but without a reproduction closing for now.