Skip to content
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

Instant navigation doesn't respect #hash #3274

Closed
5 tasks done
fottsia opened this issue Nov 30, 2021 · 7 comments
Closed
5 tasks done

Instant navigation doesn't respect #hash #3274

fottsia opened this issue Nov 30, 2021 · 7 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@fottsia
Copy link

fottsia commented Nov 30, 2021

Contribution guidelines

I've found a bug and checked that ...

  • ... the problem doesn't occur with the mkdocs or readthedocs themes
  • ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

When navigation.instant is set in mkdocs.yml, if a page1 links to page2#hash, then page2 is indeed loaded, but the #hash part is ignored.

Expected behaviour

We should navigate to the #hash header/anchor.

Actual behaviour

We are directed to the start of page2.

Steps to reproduce

Create a page1 that links to page2#anchor.

Package versions

  • Python: 3.9.9
  • MkDocs: 1.2.3
  • Material: 8.0.1

Configuration

theme:
  features:
    - navigation.instant

System information

  • Operating system: Ubuntu 22.04
  • Browser: Firefox
@squidfunk
Copy link
Owner

Could you please check if the issue also appears with 7.3.6?

@kgidarakos
Copy link

This issue also affects me.
Thanks in advance

@squidfunk
Copy link
Owner

@kgidarakos in the future, please just use the voting mechanisms on the OP and/or subscribe to the issue.

@squidfunk squidfunk added the needs investigation Issue must be investigated by the maintainers label Nov 30, 2021
@fottsia
Copy link
Author

fottsia commented Nov 30, 2021

In 7.3.6 it's a lot better: the browser window shows page2#anchor at its middle
In 8.0.1: the browser window shows page2 at its top (i.e. the start of page)

The desired outcome should be: the browser window to show page2#anchor at its top.

I.e. 7.3.6 is a whole lot better than 8.0.1, and it's probably acceptable behavior, but maybe not ideal.

@squidfunk
Copy link
Owner

Thanks. There were some changes that might impact instant loading. If you depend on it (e.g. when you have a large search index that you only want to initialize once), the recommendation is to use 7.3.6 for now.

Repository owner deleted a comment from kgidarakos Nov 30, 2021
@squidfunk squidfunk added bug Issue reports a bug resolved Issue is resolved, yet unreleased if open and removed needs investigation Issue must be investigated by the maintainers labels Dec 2, 2021
@squidfunk
Copy link
Owner

Fixed in ebcd000. It was a regression introduced in a refactoring done in 8.0.0.

@squidfunk
Copy link
Owner

The fix was just released as part of 8.0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

3 participants