From f81ef92fbc9e6264cc8caf78e5acdc495703753b Mon Sep 17 00:00:00 2001 From: rodrigocam Date: Wed, 14 Nov 2018 22:04:52 -0200 Subject: [PATCH] Fix dropdown menu not opening for desktop-layout --- lib/assets/js/comment-form-animation.js | 2 +- src/ej/templates/jinja2/components/generic/page_header.jinja2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/assets/js/comment-form-animation.js b/lib/assets/js/comment-form-animation.js index 83c1ef2f1..5ee42e74f 100644 --- a/lib/assets/js/comment-form-animation.js +++ b/lib/assets/js/comment-form-animation.js @@ -16,7 +16,7 @@ function showForm(button) { $(document).click(function(event) { if(!$(event.target).closest('#commentform').length && !$(event.target).closest('#button-create').length) { var commentform = document.getElementById("commentform"); - if(commentform.className == "show") { + if(commentform && commentform.className == "show") { button = document.getElementsByClassName('fas fa-times')[0]; makeFormDisappear(commentform, button); } diff --git a/src/ej/templates/jinja2/components/generic/page_header.jinja2 b/src/ej/templates/jinja2/components/generic/page_header.jinja2 index 5b9465ca5..ed4c83f4f 100644 --- a/src/ej/templates/jinja2/components/generic/page_header.jinja2 +++ b/src/ej/templates/jinja2/components/generic/page_header.jinja2 @@ -36,7 +36,7 @@ // this function controls the open/close button of "conversations dropdown on page_menu function openDropDown(openDiv) { let elements = document.getElementsByClassName(openDiv); - let element = elements[1] + let element = ((elements.length > 1) ? elements[1] : elements[0]); if (element.style.display === "inline") element.style.display = "none"; else