Scroll the selected item into view when it's only partially visible — cells under the column title were counted as visible. Fixes #5107.

This commit is contained in:
Brent Simmons committed 2026-07-27 10:04:33 -07:00
1 parent f3a9bac19e
commit e9e8b46a48
1 file changed
+7 -2
@@ -24,9 +24,14 @@ extension UICollectionView {
selectItem(at: indexPath, animated: true, scrollPosition: [])
if !indexPathsForVisibleItems.contains(indexPath) {
scrollToItem(at: indexPath, at: .centeredVertically, animated: true)
// indexPathsForVisibleItems includes cells hidden under the bars —
// check the unobscured region instead.
// <https://github.com/Ranchero-Software/NetNewsWire/issues/5107>
let unobscuredBounds = bounds.inset(by: adjustedContentInset)
if let itemFrame = layoutAttributesForItem(at: indexPath)?.frame, unobscuredBounds.contains(itemFrame) {
return
}
scrollToItem(at: indexPath, at: .centeredVertically, animated: true)
}
public func middleVisibleRow() -> IndexPath? {