From 322a86ae47ae6349aeac98eec54479a24bcaa5f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Fri, 3 Feb 2023 08:56:01 +0100 Subject: [PATCH] mark: fix opening of menus if search term was found #452 --- static/js/theme.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/static/js/theme.js b/static/js/theme.js index d61fef03f0..f8e4231971 100644 --- a/static/js/theme.js +++ b/static/js/theme.js @@ -797,7 +797,7 @@ function mark() { } if( parent.tagName.toLowerCase() === 'li' ){ var toggleInputs = parent.querySelectorAll( 'input.toggle:not(.menu-marked)' ); - if( i.length ){ + if( toggleInputs.length ){ toggleInputs[0].classList.add( 'menu-marked' ); toggleInputs[0].dataset.checked = toggleInputs[0].checked ? 'true' : 'false'; toggleInputs[0].checked = true; @@ -874,11 +874,11 @@ function unmark() { while( parent && parent.classList ){ if( parent.tagName.toLowerCase() === 'li' ){ var toggleInputs = parent.querySelectorAll( 'input.toggle.menu-marked' ); - if( i.length ){ + if( toggleInputs.length ){ toggleInputs[0].checked = toggleInputs[0].dataset.checked === 'true'; toggleInputs[0].dataset.checked = null; toggleInputs[0].classList.remove( 'menu-marked' ); - } + } } if( parent.classList.contains( 'expand-marked' ) ){ parent.classList.remove( 'expand-marked' );