8

In Biblical Hermeneutics' election page, the comment links (on timestamps of the comments) are clickable if I visit https://hermeneutics.stackexchange.com/election directly.

If I visit the election page by clicking the election link from the Upcoming Events sidebar in Biblical Hermeneutics Meta (https://hermeneutics.stackexchange.com/election?cb=1), the timestamps of comments are non-clickable and therefore we cannot find the links of the comments.

Also, if I open the election page using a comment link (for example, https://hermeneutics.stackexchange.com/election#comment138932_70047), the timestamps of comments again become non-clickable and therefore we cannot find the links of the comments.

I noticed this issue in Firefox 93.0 (64-bit) (Windows 10). BTW, I am not a user of Biblical Hermeneutics.

2
  • 1
    I checked that this bug is happening in the ongoing election on Mathematics. I also noticed that if the URL reads /election/<election-number>* then the timestamps are always present, both when * = ?cb=1 as well as when * = #comment<ID>. So, for instance, https://math.stackexchange.com/election/9?cb=1 and https://math.stackexchange.com/election/9#comment8960872_4302276 (and also https://math.stackexchange.com/election/9?cb=1#comment8960872_4302276) can be used with the comment timestamps remaining clickable. Commented Nov 10, 2021 at 20:03
  • 1
    Oh, I just found out that the above was already mentioned in a comment on a different post… Commented Nov 10, 2021 at 20:14

1 Answer 1

9

This is a bug in the deeplink function (turns timestamps into anchors that allow direct linking) in Content\Js\PartialJS\full-common\12_Comments.js that gets combined into full.js.

It has this line in it:

var isElectionPage = !isQuestionPage 
                 && (location.href.endsWith('/election') 
                 || location.href.indexOf('/election/') > 0);

The conditions on location.href don't account for either query strings or fragments being present in the href attribute. That explains why it works when visiting the plain URL but not when there is more stuff following /election.

Better check on pathname there:

var isElectionPage = !isQuestionPage 
                 && (location.pathname.endsWith('/election')
                 ||  location.pathname.indexOf('/election/') > 0);

That will work based on some quick testing in the Developer Console.

0

You must log in to answer this question.

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