Skip to content

Commit ab735ad

Browse files
committed
fix scroll issue
1 parent 6fe5989 commit ab735ad

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/shared/containers/timeline-wall/index.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ function TimelineWallContainer(props) {
7777
}, [pendingApprovals]);
7878

7979
useEffect(() => {
80-
const target = document.getElementById(`${selectedFilterValue.year}-${selectedFilterValue.month}`);
80+
const target = document.getElementById(`${selectedFilterValue.year}-${(selectedFilterValue.month + 1).toString().padStart(2, '0')}`);
8181
if (target) {
82-
target.scrollIntoView({ behavior: 'smooth' }, true);
82+
const yOffset = -10;
83+
const coordinate = target.getBoundingClientRect().top + window.pageYOffset + yOffset;
84+
window.scrollTo({ top: coordinate, behavior: 'smooth' });
8385
} else {
8486
window.scrollTo({ top: 0, behavior: 'smooth' });
8587
}

0 commit comments

Comments
 (0)