mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user