motion icon indicating copy to clipboard operation
motion copied to clipboard

[BUG] Hiding header navigation causes menu item underline to start flying

Open clieee opened this issue 4 years ago • 5 comments

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.

clieee avatar Apr 27 '22 11:04 clieee

Same problem in React.js app. This especially occurs while scroll to top functionality is implemented on route changing.

marcellinkhoury avatar Sep 22 '22 22:09 marcellinkhoury

Same issue here with Next 13

benjidotdev avatar Apr 06 '23 20:04 benjidotdev

Still an issue..

oskarthansen avatar Jul 29 '23 11:07 oskarthansen

Same issue here

evannotfound avatar Sep 16 '23 19:09 evannotfound

It could be adding layout layoutRoot props to the position: fixed element helps but without a reproduction closing for now.

mattgperry avatar Jan 03 '24 14:01 mattgperry