Search code examples
javascriptreactjsinternet-explorer-11js-scrollintoview

ScrollIntoView is not working for I.E in reactjs?


Basically I have a time dropdown, But selected time is not scrolling, on I.E

scrollIntoView

if (open) {
  setTimeout(() => {
    this.props.value &&
      this[this.props.value] &&
      this[this.props.value].scrollIntoView({
        behavior: 'smooth',
        block: 'nearest',
        inline: 'nearest'
      });
  }, 300);
}

Solution

  • I tried to check your sample code and found that you are trying to using behavior: 'smooth' which is not supported in the IE browser.

    enter image description here

    I suggest you remove the behavior: 'smooth' and again try to test the issue with the IE browser.

    References:

    1. Element.scrollIntoView()

    2. scrollIntoView