fix(header): close mobile menu when switching to desktop view #668
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does
Fixes an edge-case where the mobile navigation sidebar remains open when switching
from mobile to desktop viewport sizes during responsive testing.
The mobile menu now automatically closes when the viewport crosses the desktop
breakpoint, ensuring the UI state always matches the active layout.
Changes included
Why this is needed
While testing responsive behavior on desktop (using browser resize / DevTools),
the mobile sidebar could remain visible even after entering desktop view.
This creates a confusing UI state where both desktop navigation and mobile
sidebar are visible at the same time.
Although this usually resolves on a full page refresh, developers commonly
test responsive layouts without refreshing — making this a real usability
and testing bug.
This change aligns behavior with production-grade applications, where
mobile navigation state is reset automatically on breakpoint changes.
Screenshots
Issue observed during responsive testing
Mobile navigation remains open after switching to desktop viewport:

Technical notes
matchMedia('(min-width: 768px)')listener to detect breakpoint changesScope