-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
ScrollBehavior definition is missing 'instant' for window.scrollTo #47441
Comments
Note that |
Seems like there's another task for this: |
More context: It seems like the "instant" value isn't part of the CSSOM spec https://github.com/w3c/csswg-drafts/blob/main/cssom-view-1/Overview.bs#L407 EDIT: |
This has been restored in cssom w3c/csswg-drafts#8107, please added it back. Thanks :)) |
Just encountered this issue. Would be great to have this as MDN docs seem to suggest it is an option, and I only get the behaviour I need with |
@Teamop thanks! For anyone who can't update while still in beta you can brute force this setting as a workaround:
|
Exactly. |
As noted in #47441 (comment), this is already fixed and now released in TS 5.1. |
Can this small issue being published to latest 4.x? Upgrading to 5.x is a big change to the project and the entire eco |
Bug Report
?? Search Terms
instant
ScrollBehavior
window
scrollTo
type definition
?? Version & Regression Information
v4.5.4, but it's also mentioned in #46654 (v4.4.4) and #28755 (v3.2.1)
? Playground Link
Playground link with relevant code
?? Code
?? Actual behavior
The value of
instant
cannot be assigned tobehavior
when usingwindow.scrollTo
.?? Expected behavior
The value of
instant
is allowed when usingwindow.scrollTo
according to https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo as well as in real-world testing in major browsers. I just testedwindow.scrollTo
withinstant
on Chrome, Firefox, and macOS Safari and it does not give the same behavior asauto
. In my tests,auto
produced smooth scrolling andinstant
scrolled instantly.Please note that the MDN documentation specifies different behavior options for
element.scrollTo
andelement.scrollIntoView
vs.window.scrollTo
. This bug report is specific towindow.scrollTo
. The existing ScrollBehavior type definition will most likely need to be bifurcated to handle all functions correctly.Until the type definition is fixed, you can get the instant scrolling behavior by casting as any:
The text was updated successfully, but these errors were encountered: