How to have sidebar menu scroll to selected item?

I have a very long sidebar menu on my site, that requires scrolling when certain submenu items are expanded. However, when any particular menu item is clicked and the page reloads to display that article/post, the sidebar menu resets its scroll back to the top.

Is there a way to center the sidebar scroll on whichever menu item is currently selected?

Nothing Hugo-specific. But you will find JavaScript snippets provide that feature.