In order for a link with an anchor # to work, the anchor needs to be last on the link, but the browser.js will but the searchid= parameter at the end, so the link is broken.
What needs to be done is to add the params directly after the other params and leave the #anchor at the end.
I have found no existing link that gets broken yet, but we could still fix this to make sure everywhere this script is used the links are created correctly.
It would be nice if the script was a bit more clever, but I figured out a workaround.
I can't replicate this on master anymore.