Merge pull request #6080 from dssagar93/feature/auto-scroll-on-tab-change

Auto scroll to show this item when its tab becomes active
This commit is contained in:
Bijin A B
2025-12-04 10:05:32 +05:30
committed by GitHub

View File

@@ -104,6 +104,17 @@ const CollectionItem = ({ item, collectionUid, collectionPathname, searchText })
dragPreview(getEmptyImage(), { captureDraggingState: true });
}, []);
// Auto-scroll to show this item when its tab becomes active
useEffect(() => {
if (isTabForItemActive && ref.current) {
try {
ref.current.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
} catch (err) {
// ignore scroll errors (some environments may not support smooth scrolling)
}
}
}, [isTabForItemActive]);
const determineDropType = (monitor) => {
const hoverBoundingRect = ref.current?.getBoundingClientRect();
const clientOffset = monitor.getClientOffset();