-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
window.scroll with options object used in scrollToHash is not supported in IE, Edge, Safari and older versions of Chrome #71
Comments
I also ran into this to this when testing on an Android device (chrome browser, I think). |
This is definitely something that needs fixing then. I hadn't realized that such recent browsers didn't support this. Perhaps the best approach is to just use the old syntax, and leave smooth-scrolling to the user through a scroll-behavior css property. Does this sound reasonable? |
Yeah, I think it’s going to be the simplest solution. |
Does iamdustan's smoothscroll polyfill fix this issue in older Chrome, IE, Edge, etc? If so, you might want to:
This is basically the approach I think I'm settling on in https://github.com/oaf-project (see https://github.com/oaf-project/oaf-side-effects/blob/master/src/index.ts#L294) |
AFAIK it does fix the issue. This sounds like a good solution. iirc, I already have a configuration option to allow users to switch from smoothscroll to "auto". Flipping it so that auto is the default would make a lot of sense. |
You might also consider testing for |
I hadn't heard of prefers-reduced-motion before, but that makes a lot of sense too. I won't have time to implement this for at least a few weeks, but would def be open to a PR. |
Would love a fix for this soon. Getting errors in production <3 |
Navi 0.12.8 will now use the old form of To opt in to smooth scrolling, you have a couple options:
|
In scrollToHash function
window.scroll
method is called with options object. Unfortunately, this syntax is not supported by IE, Edge, Safari and older versions of Chrome (MDN docs), which only support the old syntax, i.e.window.scroll(x-coord, y-coord)
.Top 3 JS errors on our site reported by TrackJS are caused by this issue :/ Unfortunately some browsers that don't support it don't throw any error and simply scroll to
0, 0
, but e.g. older versions of Chrome (e.g. 55, even though it should work according to MDN) throw the following error:The text was updated successfully, but these errors were encountered: