From 80c788bbeb875e724230a6ce64f09f98bbfe6f40 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Tue, 8 Aug 2017 11:25:36 +0100 Subject: [PATCH] fixed JS error when no sidebar exists --- app/assets/javascripts/fly_out_nav.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/javascripts/fly_out_nav.js b/app/assets/javascripts/fly_out_nav.js index 9012f8b1a14..9a2ab7f82b1 100644 --- a/app/assets/javascripts/fly_out_nav.js +++ b/app/assets/javascripts/fly_out_nav.js @@ -135,6 +135,9 @@ export const documentMouseMove = (e) => { export default () => { const sidebar = document.querySelector('.sidebar-top-level-items'); + + if (!sidebar) return; + const items = [...sidebar.querySelectorAll('.sidebar-top-level-items > li')]; sidebar.addEventListener('mouseleave', () => {