fix(DocsLayout): keep sidebar open while dropdown menu is active#863
fix(DocsLayout): keep sidebar open while dropdown menu is active#863sukvvon wants to merge 3 commits intoTanStack:mainfrom
Conversation
👷 Deploy request for tanstack pending review.Visit the deploys page to approve it
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe sidebar auto-hide behavior in DocsLayout was enhanced to prevent hiding when a dropdown menu inside the sidebar is open. A check for Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
Keep the docs sidebar open while a dropdown menu opened from inside it (e.g.
FrameworkSelect,VersionSelect) is active. The sidebar will only close after the dropdown is dismissed.Why
When a user hovered the sidebar to expand it and then opened the framework or version select, moving the pointer away from the sidebar (e.g. into the dropdown options or any blank space) closed the sidebar while the dropdown remained open. This left the dropdown floating without its parent context, which is disorienting.
Approach
In
onPointerLeaveof the expanded menu, check whether any element withdata-state="open"exists insideexpandedMenuRef. If so, skip the close timer. Once the dropdown closes, the next leave event behaves normally.This scopes the check to the sidebar's own dropdown triggers, so unrelated dropdowns elsewhere on the page are not affected.
Screenshot
AS-IS
TO-BE
Summary by CodeRabbit