This is building out now.
This was an oversight when revamping some other elements of the UI. But... Shog pointed out that hash-linking also broken in a variety of cases so I worked up a better solution.
- If it's a question link and the current URL hash isn't
location.hash = '#question' and highlight the question body.
If it's a question link and the current URL hash is
If it's an answer link and the answer exists on the page, use the same logic as question but with the appropriate hash and element.
If it's an answer link and the answer does not exist on the page, do nothing and let the link navigate you to a version of the page with the answer.
If it's a comment link and the post with the comment exists on the page and the link hash doesn't match the hash, set
- If it's a comment link and the post with the comment exists on the page and the link hash matches the hash, call the expand, scroll to, and highlight code directly.
- If the post isn't there, navigate to the link like we did for comments.
This also reduces the visual elements on the page and better matches what we were doing before.