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

URLs to permalinks within collapsed admonition blocks don't scroll to or expand the block upon initial page load #3032

Closed
5 tasks done
kleinen opened this issue Sep 16, 2021 · 7 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@kleinen
Copy link

kleinen commented Sep 16, 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

The initial loading of a URL to a permalink located within a collapsible admonition block will not scroll to that link nor automatically expand the collapsed block. This used to work in past versions of mkdocs-material, but I am not sure exactly what version this changed in.

Expected behaviour

A URL to a permalink located within a collapsible admonition block, when loaded in a new browser window or tab, would automatically scroll to that block and expand it to where the permalink is located.

Actual behaviour

The page loads, but it loads as if no permalink was used. Also, using the same permalink from the TOC does not change the page (since it must think its already at that page). Switching to a different TOC link on the same page and clicking on the original permalink in the TOC works.

Steps to reproduce

  1. Using the included mkdocs.yml (from below) and the following docs/index.md document:
# Test

??? success "Section 1"
    ## Section 1

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...

??? success "Section 2"
    ## Section 2

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...
  1. Open a new browser window or tab and go to http://0.0.0.0:8000/#section-2 (assuming you are hosting from 0.0.0.0:8000).
  2. Notice that it does not automatically scroll to Section 2 or expand the collapsed admonition block.

Package versions

Using the squidfunk/mkdocs-material:7.2.6 docker container hosted on Ubuntu 20.04 Linux

Configuration

site_name: 'Site'

markdown_extensions:
  - admonition
  - pymdownx.details

System information

  • Operating system: squidfunk/mkdocs-material docker container hosted on Ubuntu 20.04 Linux
  • Browser: Chrome, Firefox
@squidfunk
Copy link
Owner

Thanks for reporting. What’s the last version that worked for you? Could you try narrowing down the version that broke it?

@kleinen
Copy link
Author

kleinen commented Sep 16, 2021

Sure. I'll do my best to narrow it down.

@kleinen
Copy link
Author

kleinen commented Sep 16, 2021

I went back and it seems as if it stopped working when the project released 7.0.1 (the docker container tag). v6.2.8 does not exude this issue.

BTW, mad props on how responsive you are. 😄

@squidfunk
Copy link
Owner

Thanks for narrowing it down, I’ll take a look when I find some time!

@squidfunk squidfunk added the bug Issue reports a bug label Sep 16, 2021
@kleinen
Copy link
Author

kleinen commented Sep 16, 2021

You are truly appreciated! Thanks!

@squidfunk
Copy link
Owner

Fixed in 726888c. This bug is indeed a regression related to the rewrite in 7.0.0. I'll revisit the whole anchor/hash positioning pipeline at some point in the future, as it needs some refactoring, probably when anchor tracking made its way into master.

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Sep 19, 2021
@squidfunk
Copy link
Owner

Released as part of 7.2.7.

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