KayHayen
KayHayen
KPCKevin Powell - Community
Created by KayHayen on 3/29/2024 in #front-end
Workaround CSS for smooth scrolling buggy in Google Chrome
Hello, following a video of Kevin, I think I discovered smooth scroll and enabled it right away, only to find it breaks in-page anchor links from a table of contents. I currently have this code:
html {
scroll-behavior: smooth
}
html {
scroll-behavior: smooth
}
It breaks links on Google Chrome, there is jumping to the anchor, these links don't work, I saw the bug on their issue tracker, seems they haven't fixed it since 2022, basically you cannot do that. It breaks JavaScript jumps as well, but I don't use those. Now in order to rescue this for Safari, Firefox, and all the well behaved browsers, how to wrap it in a media query, such that it gets executed on everything not Google Chrome. Webkit itself is not enough to see the bug, I think it's their JavaScript engine interfering. So, I guess, I want the thing that shall not exist, a browser query. I know that people select browser versions by prefix availability, are there such for use with Google Chrome detection? My web searches are in vain. Nobody does that thing. But then, does everybody just not use the feature then?
42 replies