scrollTo an specific element in new component

I have a customized list feature with select boxes on modal.

expected behavior -> scroll to the selected list option on modal open.
here is what i tried.
1.

const el = document.getElementById('elementToView');
window.scrollTo(el)
el.scrollIntoView({block: "end", inline: "nearest"});

neither of them worked.

is there any way to work around ?
Thank you.