Page Transition causing current menu items not working

I noticed the current page menu is also an issue with Pjax, too.
But I want to try fixing it myself. However, I’m at a loss for where to start.

Do any of you have such a situation? How do you fix it?

Can someone shed some light on the direction?