Settings: use 'smooth' instead of 'instant' scroll.

With 'instant', it is not clear that we are actually scrolling within the existing page (not opening a new page).
This commit is contained in:
infinite-persistence 2021-09-13 09:58:43 +08:00
parent bbcdcfe4c1
commit 43564c8b45
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -56,7 +56,11 @@ export default function SettingsSideNavigation() {
const TOP_MARGIN_PX = 20;
const element = document.getElementById(section);
if (element) {
window.scrollTo(0, element.offsetTop - TOP_MARGIN_PX);
window.scrollTo({
top: element.offsetTop - TOP_MARGIN_PX,
left: 0,
behavior: 'smooth',
});
}
}