fix: Mobile hamburger menu and iPad sidebar visibility
Mobile fixes: - Add click toggle handler for hamburger menu (was hover-only) - Menu now opens/closes on tap and closes when clicking outside - Keep hover support for desktop iPad fixes: - Sidebar content now visible on touch devices (901-1280px) - Added (hover: hover) media query to prevent hide-on-hover on tablets Security improvements: - Replace exec.CommandContext with go-git library for git operations - Add path traversal and command injection prevention - Fix race condition in template hot reload - Add environment-based cookie Secure flag Code quality: - Add constants.go for magic numbers - Remove unused code (ParsePreferenceToggleRequest, DomainError) - Add FOUC prevention with inline critical CSS - Add Makefile dev/run/clean targets - Fix README git clone URL - Add doc/DECISIONS.md for architectural decisions Tests: - Add hamburger menu click toggle tests - Add iPad sidebar visibility tests - Update security tests for go-git implementation - Add cookie Secure flag tests
This commit is contained in:
+16
-2
@@ -24,7 +24,8 @@
|
||||
|
||||
/**
|
||||
* Initialize minimal menu control system
|
||||
* CSS handles most logic, JS just bridges hamburger to menu
|
||||
* CSS handles most logic, JS bridges hamburger to menu
|
||||
* Click toggle for mobile, hover for desktop
|
||||
*/
|
||||
function initMenuSystem() {
|
||||
const hamburgerBtn = document.querySelector('.hamburger-btn');
|
||||
@@ -32,7 +33,20 @@
|
||||
|
||||
if (!hamburgerBtn || !menu) return;
|
||||
|
||||
// Show menu on hamburger hover - CSS handles the rest
|
||||
// Click handler for mobile - toggles menu-open class
|
||||
hamburgerBtn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
menu.classList.toggle('menu-open');
|
||||
});
|
||||
|
||||
// Close menu when clicking outside (for mobile)
|
||||
document.addEventListener('click', (e) => {
|
||||
if (!menu.contains(e.target) && !hamburgerBtn.contains(e.target)) {
|
||||
menu.classList.remove('menu-open');
|
||||
}
|
||||
});
|
||||
|
||||
// Desktop hover support - show menu on hamburger hover
|
||||
hamburgerBtn.addEventListener('mouseenter', () => menu.classList.add('menu-hover'));
|
||||
|
||||
// Hide menu when leaving hamburger if not hovering menu
|
||||
|
||||
Reference in New Issue
Block a user