You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ScrollBehavior definition is missing 'instant' for scrollToΒ #46654
I stand corrected! For anyone else who comes across this, in my testing I found that browsers do indeed treat instant the same as auto, so it's safe to simply drop the property unless you need smooth.
Reacted by Ben Boyle and ecomizzoli
Reacted by Pham Minh Hoang Henry, Mohab Yasser Rageh, λ°μ²(Cheon Park), Eric (Yiqi) Hou, JiΕΓ Thiemel, squishyu, Roman Vladimirov, Igor Lezhnin and spin311
I stand corrected! For anyone else who comes across this, in my testing I found that browsers do indeed treat instant the same as auto, so it's safe to simply drop the property unless you need smooth.
That most definitely is not true. It depends on the CSS property scroll-behaviour value . The instant value needs to be allowed for behavior property of scrollTo and scrollIntoView.
The default value is auto. That one you can omit as developer. Not this one. When the scroll-behaviour is set to smooth and you want to scroll to an element without the animation then you need to pass behavior: instant. See https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo#behavior
Reacted by Will Hawker, squishyu, Vivek Jain, Mark Fisher and Henry Myers
I stand corrected! For anyone else who comes across this, in my testing I found that browsers do indeed treat instant the same as auto, so it's safe to simply drop the property unless you need smooth.
not ideally solution but this works for me when upgrading typescript might not be an option.
Activity
PaperStrike commentedon Nov 3, 2021
I guess it's microsoft/TypeScript-DOM-lib-generator@fe01c9a#r31507840,
instantisn't valid anywhere ever since.You may need to info MDN folks to update the docs. π
patik commentedon Nov 3, 2021
I stand corrected! For anyone else who comes across this, in my testing I found that browsers do indeed treat
instantthe same asauto, so it's safe to simply drop the property unless you needsmooth.ObjectAssign commentedon Sep 17, 2022
Craig Patik (@patik) auto to me works as scrolling does, I guess that is because I have enabled smooth scroll in my browser...
However, I would really like the instant to be available
replaced `scrollTo(behaviour: "instant")` with `scrollTo(behaviour: "β¦
Pass CI TypeScript
Pass CI TypeScript
thiemjir commentedon May 30, 2024
That most definitely is not true. It depends on the CSS property
scroll-behaviourvalue . Theinstantvalue needs to be allowed forbehaviorproperty ofscrollToandscrollIntoView.The default value is
auto. That one you can omit as developer. Not this one. When thescroll-behaviouris set tosmoothand you want to scroll to an element without the animation then you need to passbehavior: instant. See https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo#behaviorhelloint commentedon Sep 26, 2024
not ideally solution but this works for me when upgrading typescript might not be an option.