8

Previously, there was hash linking used whenever there is more than one flag on a question so the page doesn't get refreshed. Even the comments were linked in that way. That made easier to get to the flagged content.

However, in the new design, there is no such thing. The page gets refreshed whenever I click on the flagged post. And for the comment flag, I have to look for the flagged one in the pile of comments. (IPS gets too many comments and therefore flags).

Can we do the hash-linking like before?

7

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.

Now, Question, answer, and comment links in the bar point to the canonical URL, like they do in the dashboard but we have JavaScript intercept with the following logic:

  • If it's a question link and the current URL hash isn't #question, set location.hash = '#question' and highlight the question body.
  • If it's a question link and the current URL hash is #question, scroll to the question via JavaScript and highlight it.

  • 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 location.hash = ... and let the existing JavaScript expand, scroll to, and highlight the comment.

  • 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.

  • If it's an answer link and the answer does not exist on the page in which scenario will this happen? – A J Jul 2 at 1:52
  • 1
    Answer paging. Questions with many answers have multiple pages of answers and the only way to guarantee an answer is on the page is to include the ID in the URL. – Brian Nickel Jul 2 at 3:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .