SharePoint Modern Library: Cannot exit “Expand content” mode

SharePoint Modern Library Experience: command ribbon

After clicking on the “Expand content” command button I have found myself scratching my head:

  • Where is the “Collapse content” command button?
  • Where has the command ribbon gone?
SharePoint Modern Library Experience: “Expand content” command

Well, the command ribbon is still there, it is just hidden by the ‘top placeholder’. Or more precisely, what has loaded into the ‘top placeholder’. For example: Hub Site Navigation or a SPFx Extension.

Having done a few web searches, I’m not the only one seeing this bug and apparently Microsoft is planning to fix the bug. In the meantime, here are two workarounds:

  1. Delete your browser cache (including cookies) and reload the page
  2. Open your browser’s developer tools (e.g. press F12).
    • Select the ‘Console’ tab
    • Paste in the following code
    • Press enter
document.querySelectorAll("button[title='Collapse content']")[0].click();

And now you should see the modern command ribbon again.