This was reported on GitHub already in #7732 and #23643.
It seems like this is fixed by the new navigation system in 4.0. If you can upload a minimal reproduction project on GitHub, you can comment on #23643 since ideally, this should still be fixed for 3.x.