Currently we are facing issue with custom SPFx web part on a very long SharePoint online modern pages. I suspect it's due to some kind of Lazy loading of modern page.Our SPFx web part basically provides an Anchor tag which links to different section in same page. When we create a different section (using Text web part), we are adding another SPFx web part which acts as placeholder div and assigns "id" to the placeholder.
When user clicks the Anchor tag whose section resides somewhere down in the page ( with div element <div id="SectionY"> ), It does not jump to the respective section. We noticed that, idocument.getElementById('SectionY') or $('#SectionY') is null. Apparently if we scroll down and then try to get element by its Id, We are getting the element (we tried it in Chrome Console).
Anyone facing similar issues? How does modern SharePoint online page rendering is different than classic site pages? Is there any other way to access complete DOM of the page when page is very long?.