UItableview keeps jumping when disabling the scroll.

I have been having issue with tableview changing its content offset when disabling the scroll on the button click. Is this the expected behaviour?

This is with Xcode 15 and iOS 17.