squidfunk / mkdocs-material

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

Scroll active navigation/toc item into view #1567

Closed majkinetor closed 4 years ago

majkinetor commented 4 years ago

Is this already supported or am I missing something ? If not, consider this feature.

While the nav element is currently highlighted, it is not scrolled to so depending on the screen/window size it is not visible.

For example Sphinx supports this. Here is example:

This will hightlight license in nav on the left.

squidfunk commented 4 years ago

This is a nice idea, but has a rather low priority. Material for MkDocs 5 is going to be released today, which might cause some problems downstream like with every major version, so my next weeks are quite set. If somebody wants to go ahead, knock yourself out 😊

majkinetor commented 4 years ago

Oh, no problem. This is definitelly low prio stuff, more pedantic then anything else.

squidfunk commented 4 years ago

How should this functionality work exactly? Element.scrollIntoView doesn't work on scrollable containers, just on the body. Would you care to prototype the functionality, so I could integrate it?

majkinetor commented 4 years ago

I have negative time available now but I will try to get back on it in few weeks.

squidfunk commented 4 years ago

There was literally no reaction on this proposal, except the OP. Give the missing interest, I’m closing this. Also, I haven't see any site implementing this, except the link provided in the OP.

max-hardcoder commented 3 years ago

Hi, I'm interressed in that kind of functionnality, cause the left nav is huge (autogenerated) and we have to put a handwritted nav in md file to navigate through the site cause it's too long to find the nav item.. but i do understand the low priority. Thank's for reading.

chr-hen commented 2 years ago

Hi there,

I've read through this thread and seen that it's been deemed quite a low-priority change, which I understand.

I'd just like to try and revive some interest in this, though, given that myself and other users and finding it quite problematic as the nav section grows on a given project. It would be really helpful if the nav bar automatically scrolled to the current page.

squidfunk commented 2 years ago

@chr-hen this functionality was added in insiders-4.8.0, see https://github.com/squidfunk/mkdocs-material/issues/2155#issuecomment-1030816004.

chr-hen commented 2 years ago

@squidfunk Thanks a lot for your prompt reply and all your work on this awesome project, much appreciated.