mkdocs-material: Instant loading does not work with section anchors in Safari

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

Beginning with version 7.0.0 anchors defined on headings do not work with Safari 15.4 macOS

Expected behaviour

Clicking the the link on the TOC should jump to the section in the main content Using a URL with # anchor should open the page at the location.

Actual behaviour

Page stays on top

Steps to reproduce

Run website and click on a H3 link on the right side

Package versions

  • Python: Python 3.8.7
  • MkDocs: mkdocs, version 1.1.2 from /usr/local/lib/python3.8/site-packages/mkdocs (Python 3.8)
  • Material: 7.0.0

Configuration

site_name: Test Site
nav:
  - Home: /
theme:
  name: material
  features:
     - navigation.instant
markdown_extensions:
  - toc:
      permalink:

System information

  • Operating system: macOS 12.3.1
  • Browser: Safari 15.4

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 19 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Released as part of 9.1.1.

The issues should be fixed in #5023. I’ve taken the time and did a complete rewrite of instant loading. It should be much more stable now. I’ll issue a new release shortly, so we can find any remaining bugs quickly, but I’m quite confident that scroll restoration should work much better now. I’ve tested in Chrome, Firefox and Safari.

I’ve had navigation.instant disabled for the last year due to the same issue. I tried the fix you linked yesterday. It seemed to solve the issue.

  1. Enabled navigation.instant and checked to be sure the bug was still occurring in Safari.

    • It was. Anchor links did not work in Safari.
  2. Uninstalled and reinstalled using the command line you supplied.

  3. Checked to see if the anchor links now worked in Safari.

    • They did.

I didn’t have time to thoroughly regression-test or anything.

Oh, sorry, I missed the reload. It wasn’t apparent in your screencast and you did not mention it explicitly. I can reproduce it when reloading. Reopened. I’ll look into it when I find some time!