squidfunk / mkdocs-material

Documentation that simply works
https://squidfunk.github.io/mkdocs-material/
MIT License
21.24k stars 3.58k forks source link

Code selection link sometimes miscalculates the code ID #5066

Closed hellt closed 1 year ago

hellt commented 1 year ago

Context

website: https://learn.srlinux.dev/get-started/

Bug description

Using insiders 4.32.0 where the code selection feature was released I noticed that while navigating among pages and clicking on code selection sometimes code block ID is detected wrongly.

Related links

Reproduction

I couldn't reproduce this using squidfunk site, but maybe you may get a feeling as to why this could have happened on my website. Therefore the zip is missing.

https://user-images.githubusercontent.com/5679861/219975910-bb609246-43d7-42cb-b328-26033bd1bbf0.mp4

This video shows that code selection first correctly identified code block ID as 0, then I switched to anther page via the menu element, got back, clicked on code selection again, and Code ID became 12.

Steps to reproduce

Couldn't reproduce on squidfunk's site. On my site the reproduction steps are:

  1. click on code selection, check the link in the URL input. If correct, change to other page on the site
  2. try 1 again

Browser

Chrome, Safari

Before submitting

squidfunk commented 1 year ago

I couldn't reproduce this using squidfunk site, but maybe you may get a feeling as to why this could have happened on my website.

Sorry, but we need a reproduction.

hellt commented 1 year ago

I pinned it down to navigation.instant. When it is enabled - code IDs get messed up when switching pages. Could be related to recent issues found in the instant reloading - #5023

squidfunk commented 1 year ago

Perfect, thanks for investing the time. Can you provide a reproduction?