fix: enhance mobile overlay with instant-close functionality#35
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR updates the mobile navbar overlay so that link clicks trigger an instant-close mode (no transition) just before navigation, and ensures that subsequent openings restore normal animated behavior, including a forced reflow to reliably apply the instant-close style. Sequence diagram for updated mobile overlay instant-close behaviorsequenceDiagram
actor User
participant HamburgerButton
participant OverlayElement
rect rgb(230,230,250)
User->>HamburgerButton: click
HamburgerButton->>OverlayElement: classList.remove(instant-close)
HamburgerButton->>HamburgerButton: setMenuState(!isMenuOpen)
end
rect rgb(220,245,255)
User->>OverlayElement: click link
OverlayElement->>OverlayElement: classList.add(instant-close)
OverlayElement->>OverlayElement: classList.remove(open)
OverlayElement->>HamburgerButton: classList.remove(active)
OverlayElement->>OverlayElement: inert = true
OverlayElement->>OverlayElement: offsetHeight (force reflow)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reached
Your plan includes 1 review of capacity. Refill in 38 minutes and 32 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe mobile navigation overlay now supports immediate hiding via an ChangesMobile overlay instant-close behavior
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider adding a short code comment near
void overlayElement.offsetHeight;to explain that it’s intentionally forcing a reflow for the instant-close behavior, since this pattern can be confusing to future readers. - Review whether
.mobile-overlay.instant-closeneeds!importanton bothtransitionandvisibility, or whether scoping/selector specificity could be adjusted instead to avoid relying on!important. - Double-check all code paths that close or reopen the mobile overlay (e.g., clicking the overlay itself, escape key handlers) to ensure they consistently add/remove the
instant-closeclass so that the overlay doesn’t get stuck in a no-transition state.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider adding a short code comment near `void overlayElement.offsetHeight;` to explain that it’s intentionally forcing a reflow for the instant-close behavior, since this pattern can be confusing to future readers.
- Review whether `.mobile-overlay.instant-close` needs `!important` on both `transition` and `visibility`, or whether scoping/selector specificity could be adjusted instead to avoid relying on `!important`.
- Double-check all code paths that close or reopen the mobile overlay (e.g., clicking the overlay itself, escape key handlers) to ensure they consistently add/remove the `instant-close` class so that the overlay doesn’t get stuck in a no-transition state.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
## [1.13.2](v1.13.1...v1.13.2) (2026-05-25) ### 🐛 Bug Fixes * enhance mobile overlay with instant-close functionality ([#35](#35)) ([78ab804](78ab804))
|
🎉 This PR is included in version 1.13.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary by Sourcery
Improve the mobile navigation overlay closing behavior to avoid sluggish transitions when navigating away from the page.
Bug Fixes:
Enhancements:
Summary by CodeRabbit