How I fixed the problem that when clicking on a search result, it randomly either jumps directly to the relevant section or does not. #7389
Soyoon-Choi
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When clicking on a search result, it randomly either jumps directly to the relevant section or does not. For instance, on any page of the official Mkdocs Material website, if you search for "Repository icon" and click on the search result, the page scrolls down to position the Repository icon header anchor at the top. However, in my project, it frequently only navigated to the page containing the result, without arriving at the precise header anchor where the result is located.
To summarize, this issue was due to setting
scroll-behavior: smooth
in my custom CSS file. Since smooth scrolling is a common option, many might use it, but removing this line from custom.css immediately fixed the problem. I'm sharing this information in General, however, if anyone knows how to use smooth scrolling behavior without this issue, please let me know!Beta Was this translation helpful? Give feedback.
All reactions