Fix user dropdown accessibility in mobile/tablet menu

- Prevent sidebar from closing when clicking user dropdown toggle
- Exclude user dropdown from auto-close behavior on navigation clicks
- Position user dropdown modal correctly on mobile/tablet screens
- Increase z-index to ensure dropdown appears above mobile overlay
- Center dropdown modal on mobile/tablet for better accessibility
- Add proper event handling to prevent unwanted closures
This commit is contained in:
2025-07-14 10:32:28 +02:00
committed by Jens Luedicke
parent 6dfdc58afc
commit 7a5e271395
4 changed files with 47 additions and 2 deletions

View File

@@ -31,6 +31,10 @@ document.addEventListener('DOMContentLoaded', function() {
// Close dropdown when clicking outside
document.addEventListener('click', function(e) {
if (userDropdownModal && !userDropdownModal.contains(e.target) && !userDropdownToggle.contains(e.target)) {
// Don't close if we're clicking on the mobile overlay
if (e.target.id === 'mobile-nav-overlay' || e.target.classList.contains('mobile-overlay')) {
return;
}
userDropdownModal.classList.remove('active');
}
});