Repository navigation
feat(Combobox): add unmountOnHide prop - #2842
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: unovue/reka-ui/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughCombobox adds the ChangesCombobox unmountOnHide
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ComboboxRoot
participant ComboboxContent
participant Presence
participant ComboboxContentImpl
participant FocusScope
participant DismissableLayer
ComboboxRoot->>ComboboxContent: Provide unmountOnHide
ComboboxContent->>Presence: Derive forceMount
Presence->>ComboboxContentImpl: Pass present and visibility
ComboboxContentImpl->>FocusScope: Pass present state
ComboboxContentImpl->>DismissableLayer: Pass present state
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change is mergeable after normal checks; no actionable merge-blocking risk is established. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
commit: |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/core/src/Combobox/ComboboxContentImpl.vue`:
- Around line 101-109: Update the `watch` callback for `props.present` to detect
any active descendant within `currentElement`, rather than relying only on
`isInputWithinContent.value`. When content hides and the active element is
inside the content—including slotted `option-state` inputs—restore focus to
`rootContext.triggerElement` after `nextTick`, while preserving the existing
guards for unrelated active elements.
- Around line 57-58: Update the scroll-lock watcher beside useBodyScrollLock to
react to both props.present and props.bodyLock, ensuring scrollLocked is
recomputed and released when bodyLock becomes false while content remains
present. Add a regression test covering a bodyLock change from true to false
while the combobox is open.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 3018224d-d636-4948-a32c-4716ce88fea1
📒 Files selected for processing (8)
docs/content/meta/ComboboxRoot.mdpackages/core/src/Autocomplete/AutocompleteRoot.vuepackages/core/src/Combobox/Combobox.test.tspackages/core/src/Combobox/ComboboxContent.vuepackages/core/src/Combobox/ComboboxContentImpl.vuepackages/core/src/Combobox/ComboboxRoot.vuepackages/core/src/Combobox/story/_ComboboxManualFilter.vuepackages/core/src/Combobox/story/_ComboboxObject.vue
# Conflicts: # packages/core/src/Combobox/Combobox.test.ts # packages/core/src/Combobox/ComboboxContentImpl.vue
`pickedProps` now omits `present` by destructuring, so reading `.value` once froze the forwarded popper props. Pass the computed itself so `side`/`align` changes still reach PopperContent. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
🔗 Linked issue
Follows the Dialog precedent in #2662.
❓ Type of change
📚 Description
Adds
unmountOnHidetoComboboxRoot, defaulting totrue. Whenfalse, content stays mounted but hidden while closed, preserving expensive option subtrees and internal state across open cycles.Closed persistent content is excluded from focus, dismissal, body-scroll-lock, and surrounding-content ARIA behavior.
ComboboxContent.forceMountkeeps its existing low-level semantics. Tests cover persistence, unchanged defaults, event safety, body-lock changes, multiple instances, and cleanup.📸 Screenshots (if appropriate)
Not applicable.
📝 Checklist
Summary by CodeRabbit
New Features
unmountOnHideoption to Combobox, defaulting totrue.unmountOnHidetofalseto keep Combobox content mounted and visually hidden while closed, preserving its state when reopened.Bug Fixes