Skip to content

fix(combobox): portal content inside Theme scope (#1100)#2012

Open
kotAPI wants to merge 1 commit into
mainfrom
fix/issue-1100-combobox-portal-theme
Open

fix(combobox): portal content inside Theme scope (#1100)#2012
kotAPI wants to merge 1 commit into
mainfrom
fix/issue-1100-combobox-portal-theme

Conversation

@kotAPI

@kotAPI kotAPI commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Combobox portal targets ThemeContext refs instead of querySelector
  • Keeps optional container prop support

Fixes #1100

Test plan

  • npm test -- --testPathPatterns=Combobox

Summary by CodeRabbit

  • Refactor
    • Enhanced combobox dropdown portal rendering to use theme context for root element detection, improving compatibility when rendering dropdowns in custom theme containers.

Use ThemeContext portalRootRef and containerRef instead of
querySelector for theme-scoped portaling.

Fixes #1100
@changeset-bot

changeset-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 14eb45d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3ce1623f-0202-4e3c-8c39-3dfae8146d90

📥 Commits

Reviewing files that changed from the base of the PR and between fe87b36 and 14eb45d.

📒 Files selected for processing (1)
  • src/core/primitives/Combobox/fragments/ComboboxPrimitivePortal.tsx

📝 Walkthrough

Walkthrough

ComboboxPrimitivePortal replaces a static #rad-ui-theme-container DOM query and rootElementFound state with a ThemeContext-derived root ref (rootElementRef) and an isMounted flag. The portal now renders only after the effect resolves the root element and sets isMounted.

Changes

ComboboxPrimitivePortal Root Resolution

Layer / File(s) Summary
Portal root resolution and render gate
src/core/primitives/Combobox/fragments/ComboboxPrimitivePortal.tsx
Imports useRef and ThemeContext; replaces rootElementFound state and the #rad-ui-theme-container querySelector with rootElementRef assigned inside useEffect from container, then themeContext refs, then document.body, followed by setIsMounted(true); the render gate changes from !rootElementFound to !isMounted, and Floater.Portal receives root={rootElementRef.current}.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇 No more hunting #rad-ui-theme-container by name,
The ThemeContext whispers, "I know the right frame!"
A ref holds the root, a flag says "I'm here,"
The portal blooms only once the path is clear.
Less querying DOM, more context in sight —
The rabbit hops on with everything right! 🌸

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing the combobox portal to render content within the Theme scope.
Linked Issues check ✅ Passed The PR addresses issue #1100 by implementing context-based portal root resolution instead of querySelector, ensuring portals render within the Theme scope.
Out of Scope Changes check ✅ Passed All changes are focused on the ComboboxPrimitivePortal component to resolve portal root via ThemeContext, directly addressing the linked issue requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-1100-combobox-portal-theme

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage

This report compares the PR with the base branch. "Δ" shows how the PR affects each metric.

Metric PR Δ
Statements 75.73% +0.00%
Branches 59.18% +0.01%
Functions 61.75% +0.00%
Lines 77.27% +0.01%

Coverage improved or stayed the same. Great job!

Run npm run coverage:ci locally for detailed reports and target untested areas to raise these numbers.

@kotAPI

kotAPI commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator Author

Code review

LGTM. Matches project patterns for portal Theme refs, Floating UI prop merge, controlled-switch/lazy-mount/RTL tests, or focused bug fixes. No changes requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Alert Dialog not spawning as a child to the provided root element

1 participant