2

Vertical Stepper in material ui should scroll to the beginning of the selected step when changing step

enter image description here

One solution probably is to use ref to scroll to the stepper titles How to scroll to an element?

is there any better solution?

Material ui version 4.11.0

Hamid Shoja
  • 3,838
  • 4
  • 30
  • 45

1 Answers1

3

Just do a useEffect() on the variable that sets your step count and then in that useEffect i.e.

 useEffect(() => {
    console.log('changed step scrolling to top of window');
    window.scrollTo(0, 0)
  }, [activeStep])