You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my Next.js application, in Chrome (macOS, W11), Edge (W11), Brave (macOS) I encountered an issue with adding anchor links to MenuItem: after clicking the button, the page scrolls to the specified anchor but then, immediately jumps to the top. I did NOT observe such behavior in Safari.
The issue persists with an <a> tag around the item
Describe the bug
In my Next.js application, in Chrome (macOS, W11), Edge (W11), Brave (macOS) I encountered an issue with adding anchor links to MenuItem: after clicking the button, the page scrolls to the specified anchor but then, immediately jumps to the top. I did NOT observe such behavior in Safari.
The issue persists with an
<a>
tag around the itemor Next.js router.push() on the item.
I also discovered a workaround: setting a 1-second timeout prevents the issue:
This made me think there is an event that fires on the MenuList after the page scrolls to the required position.
Linking to other website pages seems unaffected.
To Reproduce
I've created a clean project with just this one menu to showcase the issue.
To launch it, run
npm I && run dev
and proceed tohttp://localhost:3000
Expected behavior
I expect the page to scroll to the anchor without jumping back to the top in every supported browser, not just Safari.
Priority
--
Screenshots/Video
Desktop
Works as expected in Safari on macOS
Stack
The text was updated successfully, but these errors were encountered: