Question regarding Modern Libraries, I wish to open document libraries in a Modal Dialog on a page but have only the library shown, not the Office 365 Suiter bar and left nav. I used the standard SP.UI.ModalDialog.showModalDialog function to open the library in dialog.

All works fine except the usual IsDlg=1 and ms-dialogHidden attributes to hide elements in a Dialog don't work, is there a new way to hide elements?

I am trying to hide to Office 365 suite bar, side bar when in Modal Dialog but it doesn't seem to be working, nor can I use the PnP Core.EmbedJavaScript sample as it doesn't seem to work on modern libraries.

Any help would be greatly appreciated, though I am not a guru in JS so I may be missing something.

1 Answer 1


To hide elements in modal pop up, insert this class in the element that you don't want to have in Modal pop up.

<header id="header" class="s4-notdlg">

Add the class s4-notdlg in the element you don't want in pop up. you will have to append the class in the suitebar and left-nav div, which is in your MasterPage.

Thanks... Hope it will work for you..

  • Hi Ankur, that sadly won't work as it is a modern library in Office 365 where Microsoft doesn't want you to tampering with the MasterPage due to their "evergreen" service. Also from the looks of the HTML the DOM elements are dynamically built with Knockout JS Oct 7, 2016 at 6:04
  • @GroFinJarrydP I hope you might have got the answer for this. But to update it is ?env=Embedded. This act as the replacement of IsDlg=1 on SharePoint Online Sep 14, 2021 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.