Skip to content

ScrollBehavior definition is missing 'instant' for scrollToΒ #46654

Closed

Description

@patik

Bug Report

πŸ”Ž Search Terms

instant
scrollbehavior
scrollTo
type definition

πŸ•— Version & Regression Information

v4.4.4, but it's also mentioned in #28755 (v3.2.1)

  • This is a crash

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

window.scrollTo({
  top: 0,
  left: 0,
  behavior: 'instant' // This should be allowed
})

πŸ™ Actual behavior

The value of 'instant' cannot be assigned to behavior when using element.scrollTo() according to https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo as well as testing it in a browser

πŸ™‚ Expected behavior

The value of 'instant' is allowed when using element.scrollTo() according to https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo as well as testing it in a browser. Note that a similar issue, #28755, was about scrollIntoView(), which indeed does not allow 'instant'.

Activity

  1. PaperStrike commented on Nov 3, 2021

    @PaperStrike

    I guess it's microsoft/TypeScript-DOM-lib-generator@fe01c9a#r31507840, instant isn't valid anywhere ever since.
    You may need to info MDN folks to update the docs. πŸ‘€

  2. patik commented on Nov 3, 2021

    @patik
    Author

    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.

  3. ObjectAssign commented on Sep 17, 2022

    @ObjectAssign

    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

  4. thiemjir commented on May 30, 2024

    @thiemjir

    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

  5. helloint commented on Sep 26, 2024

    @helloint

    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.

  6. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions