Skip to content

Commit

Permalink
fix search clear on close
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabowskiM committed Sep 2, 2024
1 parent 9b0af4e commit ecb8378
Showing 1 changed file with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@
}

closeBranch(branchElement) {
const searchInput = branchElement.querySelector('.ibexa-multilevel-popup-menu__search-input');

if (searchInput?.value !== '') {
searchInput.value = '';
searchInput.dispatchEvent(new Event('input'));
}

this.toggleBranch(branchElement, false);
}

Expand Down Expand Up @@ -417,18 +424,6 @@
return;
}

const branchesSearchInput = doc.querySelectorAll('.ibexa-multilevel-popup-menu__search-input');

branchesSearchInput.forEach((searchInput) => {
if (searchInput.value !== '') {
const searchInputBranch = searchInput.closest('.ibexa-multilevel-popup-menu__branch');

searchInput.value = '';
searchInputBranch.dispatchEvent(new CustomEvent('ibexa-multilevel-popup-menu:close-branch'));
searchInput.dispatchEvent(new Event('input'));
}
});

this.closeWithSubbranches(topBranch);
}

Expand Down

0 comments on commit ecb8378

Please sign in to comment.