Skip to content

fix: handle hash navigation to prevent duplicate callbacks #2575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ If you have a link to the homepage in the sidebar and want it to be shown as act

For more details, see [#1131](https://github.com/docsifyjs/docsify/issues/1131).

## themeColor ⚠️
## themeColor ⚠️ :id=themecolor

!> Deprecated as of v5. Use the `--theme-color` [theme property](themes#theme-properties) to [customize](themes#customization) your theme color.

Expand All @@ -931,7 +931,7 @@ window.$docsify = {
};
```

## topMargin ⚠️
## topMargin ⚠️ :id=topmargin

!> Deprecated as of v5. Use the `--scroll-padding-top` [theme property](themes#theme-properties) to specify a scroll margin when using a sticky navbar.

Expand Down
9 changes: 9 additions & 0 deletions src/core/router/history/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ export class HashHistory extends History {

if (el && el.tagName === 'A' && !isExternal(el.href)) {
navigating = true;

// Do not compare hash containing these classes.
if (['app-name-link', 'page-link'].includes(el.className)) {
return;
}

if (el.hash === location.hash) {
cb({ event: e, source: 'navigate' });
}
}
});

Expand Down
Loading