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.

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

neither of them worked.

is there any way to work around ?
Thank you.