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

Jumping to anchor inside details doesn't open it #540

Closed
max-ci opened this issue Oct 26, 2017 · 6 comments
Closed

Jumping to anchor inside details doesn't open it #540

max-ci opened this issue Oct 26, 2017 · 6 comments

Comments

@max-ci
Copy link

@max-ci max-ci commented Oct 26, 2017

Description

If you click on the footnote arrow at the bottom of the page and footnote is inside details it doesn't jump to the note (when details is closed).

Expected behavior

Appropiate details should be opened when you click on the footnote arrow and it should jump to the note.

Actual behavior

Clicking on the arrow doesn't work when footnote is inside details and details is closed.

Steps to reproduce the bug

  1. Create footnote in details.
  2. Click on the footnote arrow at the bottom of the page (details must be closed).

Package versions

  • MkDocs: 1.12.1
  • Material: 0.16.3

Project configuration

Irrelevant

System information

Irrelevant

Possible fix:

  1. Detect if footnote is inside details
  2. If yes - preventDefault(), if no - normal behaviour
  3. Check if details is opened, if yes - change hash in the url, if no - open it and change hash in the url
@squidfunk
Copy link
Owner

@squidfunk squidfunk commented Oct 27, 2017

Thanks for your report. The same should hold for headlines with permalinks. It's, however, a very low priority issue.

@squidfunk squidfunk changed the title Footnote in details Jumping to anchor inside details doesn't open it Oct 27, 2017
@squidfunk
Copy link
Owner

@squidfunk squidfunk commented Nov 5, 2017

Fixed in #570

@squidfunk squidfunk self-assigned this Nov 5, 2017
@squidfunk
Copy link
Owner

@squidfunk squidfunk commented Nov 5, 2017

Fix released with 2.0.3

@squidfunk squidfunk closed this Nov 5, 2017
@max-ci
Copy link
Author

@max-ci max-ci commented Nov 5, 2017

There is an error when you click on the arrow. This is because of the colon in the selector, for example #fnref:1. Need to escape this colon when using querySelector.

@squidfunk
Copy link
Owner

@squidfunk squidfunk commented Nov 5, 2017

Ah thanks, haven't tested it with footnotes, only with headlines. My fault. will provide a fix.

@squidfunk squidfunk reopened this Nov 5, 2017
@squidfunk
Copy link
Owner

@squidfunk squidfunk commented Nov 5, 2017

Just released 2.0.4 which fixes the error with querySelector by using getElementById which should be more robust for these errors.

@squidfunk squidfunk closed this Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants