scrollIntoView not working

Hello @Baptiste_LC ,

The issue likely occurs because the container isn't fully rendered when scrollIntoView is called. Try adding a delay using setTimeout to ensure the element is visible

col_cont_work.setShowBody(true);
setTimeout(() => {
    col_cont_work.scrollIntoView({ behavior: 'smooth', block: 'end' });
}, 100);

Also, ensure the container isn’t hidden by CSS (display: none;, visibility: hidden) and that no parent elements have overflow: hidden blocking scrolling. Use offsetHeight before scrollIntoView to force reflow if needed:

col_cont_work.offsetHeight; // Force reflow
col_cont_work.scrollIntoView({ behavior: 'smooth', block: 'end' });

5 Likes