add null check dropdown

This commit is contained in:
Ludy87 2025-07-18 22:45:07 +02:00
parent 64d8ef4a39
commit 4149804183
No known key found for this signature in database
GPG Key ID: 92696155E0220F94

View File

@ -123,7 +123,7 @@ if (searchDropdown && searchInput) {
// Hide dropdown if it's open and user clicks outside
document.addEventListener('click', function (e) {
if (!searchDropdown.contains(e.target) && dropdownMenu.classList.contains('show')) {
if (dropdownMenu && !searchDropdown.contains(e.target) && dropdownMenu.classList.contains('show')) {
dropdownInstance.hide();
}
});