hashchange: Fix near link not working if already narrowed to it.

In 666ce4519d, we switched to use
`this.href` instead of `e.currentTarget.getAttribute("href")`.

This bugged the behaviour since `this.href` includes the complete
URL including hostname.

Switched to use `this.hash` to fix it.
This commit is contained in:
Aman Agrawal
2025-01-14 11:51:14 +05:30
committed by Tim Abbott
parent 6d495a270e
commit 6a44364a69

View File

@@ -562,9 +562,8 @@ export function initialize(): void {
hashchanged(true);
$("body").on("click", "a", function (this: HTMLAnchorElement, e: JQuery.ClickEvent) {
const href = this.href;
if (href === window.location.hash && href.includes("/near/")) {
// The clicked on a link, perhaps a "said" reference, that
if (this.hash === window.location.hash && this.hash.includes("/near/")) {
// User clicked on a link, perhaps a "said" reference, that
// matches the current view. Such a click doesn't trigger
// a hashchange event, so we manually trigger one in order
// to ensure the app scrolls to the correct message.