What you're describing is in fact the browser's behavior when changing the hashtag. That is, navigating from domain.com
to domain.com#someId
is like asking the browser to "focus" on the element of the page which id is someId
. So the window will move to this element. Unfortunately, I don't know any fix to this.
You may want to look at this discussion I found while searching for a possible solution: Modifying document.location.hash without page scrolling.