i'm trying to implement a back-to-the-top button in my project. However, I noticed some weird behaviors in chrome on windows. then i found this post saying that it is broken since chrome and edge v81. so i tested it on browserstack. although we are describing different issues, but it does seem like the case. after two days of researching and reading through countless posts online, i don't think i've ever seen anyone mentioning the exact same problem i'm mentioning. so i do think there's just something wrong with my implementation? the problem. as you can see, on the second try, it just stopped around the halfway.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<style>
html {
scroll-behavior: smooth;
}
.a {
height: 5000px;
}
.b {
position: fixed;
right: 2rem;
bottom: 2rem;
}
</style>
<body>
<div class="a" id="a">This is the top</div>
<a class="b" href="#a">to the top</a>
</body>
</html>
so far, i've tested this on two separate windows devices and both are not working. firefox, safari, chrome (mac) both work so i guess it's related to blink? i've tried scrollTo() but got the same result.