[drawer] Prevent dialogs from affecting nested drawer stack#4493
[drawer] Prevent dialogs from affecting nested drawer stack#4493atomiks merged 8 commits intomui:masterfrom
Conversation
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
3789b18 to
3c7032c
Compare
ef5b101 to
3e7a3fb
Compare
Codex Review (GPT-5.4)This is a focused bug-fix PR that separates drawer-specific nesting visuals from generic dialog nesting while preserving the broader dialog stack semantics. I reviewed the full branch against a freshly fetched 1. Bugs / Issues (None)I did not find any branch-relevant bugs or regressions in the final diff. 2. Root Cause & Patch Assessment
The follow-up test change now checks the fixed-height handoff directly instead of relying on browser transition events, which makes the regression coverage more stable without weakening what it proves. 3. Pattern Consistency AssessmentThe implementation stays localized to the existing shared dialog store flow instead of introducing drawer-only parallel plumbing. Generic dialog topmost behavior still follows the full dialog nesting count, while drawer popup and viewport visuals consume the new drawer-only count where that distinction actually matters. 6. Test Coverage AssessmentI ran:
Both passed on the final branch head. The regression suite now covers nested RecommendationApprove ✅ The fix addresses the right root cause, keeps the blast radius contained, and the final regression suite now exercises the semantics and close-handoff paths in a way that is both meaningful and locally stable. Claude Review (Opus 4.6)Summary: The PR separates drawer-specific nesting count from generic dialog nesting count, so that a Dialog or AlertDialog opened inside a nested drawer doesn't increment --nested-drawers or retrigger parent drawer stack animations. ApproachThe fix introduces a DialogRootTypeContext (boolean, default false) to tag whether the current DialogRoot is acting as a drawer:
useDialogRoot now tracks ownNestedOpenDrawers alongside ownNestedOpenDialogs. When notifying a parent, the child passes both counts: (ownNestedOpenDialogs + 1, ownNestedOpenDrawers + (isDrawer ? 1 : 0)). DrawerPopup and DrawerViewport then read nestedOpenDrawerCount instead of nestedOpenDialogCount for drawer-specific visuals. CorrectnessI traced through the nesting propagation for several scenarios:
The counting logic correctly propagates up the tree. Each layer adds 1 to dialogCount for itself and conditionally adds 1 to drawerCount only if isDrawer is true. Issues FoundNone blocking. Two minor observations:
Pattern Consistency
Test CoverageTests are comprehensive and well-structured:
Bundle Impact+116B gzipped (+0.08%) — negligible. VerdictApprove — clean, minimal fix that correctly addresses the root cause with appropriate test coverage. |
Fixes #4492
This keeps drawer-specific nesting visuals tied to nested drawers instead of generic nested dialogs. A dialog opened inside a nested drawer no longer increments
--nested-drawersor retriggers the parent drawer stack animation.Changes
Drawer -> Drawer -> Dialogcase.