Issue with accessing DOM of very long SharePoint online modern pages

Occasional Contributor


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?.



1 Reply

@gurudatt bn 


Hi I was googling this issue and stumbled on this post. I'm experiencing this same issue on a standard release tenant, but not a target release tenant. It does mess up some spfx web parts which depends on the entire DOM being loaded upon page open.


Did you ever get any new information on this?