From 4da0ffc55d7ca1bf4276ca2cc96515ee523e9e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Thu, 14 May 2020 20:32:09 +0200 Subject: [PATCH] Fix Talk sidebar in public share pages without header actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ".header-right" element may not exist in the public share page if there are no header actions, for example, if the downloads of the share are hidden. In that case the ".header-right" element needs to be explicitly added. Signed-off-by: Daniel Calviño Sánchez --- src/mainPublicShareSidebar.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mainPublicShareSidebar.js b/src/mainPublicShareSidebar.js index 493b628f55..9946557422 100644 --- a/src/mainPublicShareSidebar.js +++ b/src/mainPublicShareSidebar.js @@ -86,6 +86,15 @@ function addTalkSidebarTrigger() { talkSidebarTriggerElement.addEventListener('click', () => { sidebarState.isOpen = !sidebarState.isOpen }) + + // The ".header-right" element may not exist in the public share page if + // there are no header actions. + if (!document.querySelector('.header-right')) { + const headerRightElement = document.createElement('div') + headerRightElement.setAttribute('class', 'header-right') + document.querySelector('#header').append(headerRightElement) + } + document.querySelector('.header-right').append(talkSidebarTriggerElement) }