I'm experiencing an odd behavior with how MultimediaViewer uses anchor tags. I expect that when I use the 'close' command I am taken back to the page I was viewing. Like using the 'back' button in any common browser. However, I seem to get stuck in a loop when using the "close" icon and the back button to return to a previous page.
Imagine you visit a wiki page, say "History of Wikipedia". Then from there you click on "VisualEditor". Lastly, you click on an image in the VisualEditor article describing the HTML-RDFa content model. After viewing the image, you close the MultimediaViewer modal either via the "X" button or the Esc key. Now, you use the back button in the toolbar (or even the 'swipe right' gesture in Chrome or Safari) to return to the previous page - in this instance "History of Wikipedia". However, the back command instead returns you to the MultimediaViewer modal of the image you were just viewing.
This is confusing, as you haven't left the VisualEdtor page (the url is a #mediaviewer anchor tag). This breaks the expected behavior of the "Back" command and the expected behavior of anchor tags. I would expect that when I'm looking at the VisualEdtor page that my back command would take me back to "History of Wikipedia", not the image within the page.
I made a short video demonstrating the loop you can get stuck in. This was in Safari 8 on OS X Yosemite using the 'back' gesture.
https://www.youtube.com/watch?v=Q7H1sFWIhYU&feature=youtu.be