I recently had a user ask me to create a web part page which had a document library & content editor web part which described the purpose of the library & where to get more information should they need it. By doing this, the ribbon context was lost which meant that the users no longer received Files & Library tabs – they could get the tabs back by clicking in the library but not all users were aware of this.
|Ribbon without context|
|Ribbon with context|
Luckily, there’s a simple fix for this. Adding a script editor and using the script below will add an event that sends a dummy click to the element which will return the tabs as they should be. Please note, the ID of the element will need to be changed to the document library you want to add the ribbon context too.