I'm using UICollectionViewCompositionalLayout and the *UICollectionLayoutSectionOrthogonalScrollingBehavior to build a carousel.
The scrollToItem() method will correctly scroll to the item at the specified indexPath but will create a top-inset (animates it smoothly). It doesn't inset the rest of the content though, which will make the cell overlay subsequent content. (Here a section footer with a page control)
This top-inset will be the size of a section header + the contentInset of the layout section.
Any subsequent scrolling initiated by the user will cause the layout to update and make the cell jump to the correct position.
The problem occurs only when using one of the .paging behaviours for orthogonal scrolling.
I've tried to mess with the layout item in visibleItemsInvalidationHandler but I have not found a way to distinguish whether the handler is called because the user scrolled or because the scrollToItem() method was called programmatically.
Check out the sample project on github
I'm using Xcode 13.0 and iOS 15.0