I'm using UICollectionView with a list style on Mac (looks like NSOutlineView in a sidebar). I have expandable rows.
So this is the behavior I'm after:
-If the user has a row selected, but decides to collapse the selected row's parent, I want to maintain the current selection.
Instead this is what happens by default:
-If a row selected and I collapse the parent the collection, the collection view automatically selects another row (in my case the first row at index path 0-0).
Just because the user collapses the parent doesn't mean the selection should change. For instance in Xcode's Navigator I can have a file selected in a Group and collapse the group without modifying the current selection.
Actually I get the behavior I expect by default as long as the selected row isn't also focused (the collection view is configured to have the selection follow focus, which is something I want).
Only thing I can think of is to manually implement the expandable row's UICellAccessoryOutlineDisclosure actionHandler, set selectionFollowsFocus to NO before I collapse the row, then set selectionFollowsFocus to YES after the animation finishes. Feels like this is way more work then it should be though.