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 feature conflicts with navigation.tracking #6719

Closed
4 tasks done
CNSeniorious000 opened this issue Jan 31, 2024 · 5 comments
Closed
4 tasks done

instant navigation feature conflicts with navigation.tracking #6719

CNSeniorious000 opened this issue Jan 31, 2024 · 5 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@CNSeniorious000
Copy link

CNSeniorious000 commented Jan 31, 2024

Context

I want to use the SPA feature, but it seems it break some other features.

Bug description

If I select navigation.instant together with navigation.tracking, the navigation.tracking won't work.

(I am on latest mkdocs and mkdocs-material, using latest python on Windows 11.)

Related links

Reproduction

9.5.6-feature-conflicts.zip

Steps to reproduce

  1. Download this minimal project file: all-files.zip
  2. Run pdm install to install mkdocs>=1.5.3 and mkdocs-material>=9.5.6
  3. Run pdm dev to start mkdocs serve server
  4. Open localhost:8000 and the url won't change with scrolling
  5. By the way, the toc highlight won't work too, I don't know why
  6. Remove - navigation.instant, then restart the server by terminate the server and restart it manually
  7. The toc and the url works fine again. So I think it is navigation.instant's fault

By the way, I find that navigation.instant won't work in the mkdocs build results. I don't know why. But you can reproduce it using:

  1. Run pdm gen to invoke mkdocs build command
  2. Serve the site folder using any static server (or visiting this demo which is my run results)
  3. Open the browser and try to navigate

Browser

Edge

Before submitting

@squidfunk squidfunk added the needs investigation Issue must be investigated by the maintainers label Feb 1, 2024
@squidfunk
Copy link
Owner

squidfunk commented Feb 2, 2024

Thanks for reporting. Definitely related to our latest refactoring of instant navigation in 9.5.5.

Temporary mitigation: disable navigation.instant or downgrade to 9.5.4:

pip install --force-reinstall mkdocs-material==9.5.4

@squidfunk squidfunk added bug Issue reports a bug and removed needs investigation Issue must be investigated by the maintainers labels Feb 2, 2024
@squidfunk
Copy link
Owner

squidfunk commented Feb 3, 2024

Fixed in 88004be. This was a regression introduced in 9.5.5 which impacted the following features:

  • navigation.tracking
  • toc.follow

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Feb 3, 2024
@squidfunk
Copy link
Owner

Released as part of 9.5.7.

@CNSeniorious000
Copy link
Author

Thank you! The navigation.instant featrue works fine in mkdocs serve with navigation.tracking and toc.follow, but there is still a problem:

The navigation.instant works only in mkdocs serve environment, not for the mkdocs build results.

I update the mkdocs.yml as follow:

site_name: My Docs
theme:
  name: material
  features:
+   - navigation.instant
+   - navigation.instant.progress
    - navigation.tracking
    - toc.follow

And I update the version of mkdocs-material in pyproject.toml like this:

- dependencies = ["mkdocs>=1.5.3", "mkdocs-material>=9.5.6"]
+ dependencies = ["mkdocs>=1.5.3", "mkdocs-material>=9.5.7"]

All the other files are the same as before.

You can reproduce this by simply update mkdocs.yml and pyproject.toml like this, or visit the bug demo I redeployed.

I think it is a bug in mkdocs's JavaScript bundling process during mkdocs build, but I am not familiar with mkdocs so I can't dive into the code too much.


Or, should I open a new issue or provide a new reproduction zip file?

@squidfunk
Copy link
Owner

You're likely missing the site_url setting. I explained why this is necessary for instant previews in #6704 (comment) , which is the same reason it is necessary for instant navigation.

bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Feb 7, 2024
https://build.opensuse.org/request/show/1144834
by user dirkmueller + anag+factory
- skip build for python 3.12

- update to 9.5.8:
  * Added Tamil translations
  * Updated Esperanto translations
  * Fixed relative images not being resolved for instant
    navigation

- update to 9.5.7:
  * Fixed #6731
    <squidfunk/mkdocs-material#6731>:
    Small images in figures are not centered
  * Fixed #6719
    <squidfunk/mkdocs-material#6719>:
    Instant navigation breaks table of contents (9.5.5 regression)
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

2 participants