mark: fix opening of menus if search term was found #452

This commit is contained in:
Sören Weber 2023-02-03 08:56:01 +01:00
parent 94e993b60e
commit 322a86ae47
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -797,7 +797,7 @@ function mark() {
} }
if( parent.tagName.toLowerCase() === 'li' ){ if( parent.tagName.toLowerCase() === 'li' ){
var toggleInputs = parent.querySelectorAll( 'input.toggle:not(.menu-marked)' ); var toggleInputs = parent.querySelectorAll( 'input.toggle:not(.menu-marked)' );
if( i.length ){ if( toggleInputs.length ){
toggleInputs[0].classList.add( 'menu-marked' ); toggleInputs[0].classList.add( 'menu-marked' );
toggleInputs[0].dataset.checked = toggleInputs[0].checked ? 'true' : 'false'; toggleInputs[0].dataset.checked = toggleInputs[0].checked ? 'true' : 'false';
toggleInputs[0].checked = true; toggleInputs[0].checked = true;
@ -874,7 +874,7 @@ function unmark() {
while( parent && parent.classList ){ while( parent && parent.classList ){
if( parent.tagName.toLowerCase() === 'li' ){ if( parent.tagName.toLowerCase() === 'li' ){
var toggleInputs = parent.querySelectorAll( 'input.toggle.menu-marked' ); var toggleInputs = parent.querySelectorAll( 'input.toggle.menu-marked' );
if( i.length ){ if( toggleInputs.length ){
toggleInputs[0].checked = toggleInputs[0].dataset.checked === 'true'; toggleInputs[0].checked = toggleInputs[0].dataset.checked === 'true';
toggleInputs[0].dataset.checked = null; toggleInputs[0].dataset.checked = null;
toggleInputs[0].classList.remove( 'menu-marked' ); toggleInputs[0].classList.remove( 'menu-marked' );