Fix navigating by anchor results in an empty detail view being opened

fixes #5871