Repository navigation
feat(ConfigProvider): add teleportTo for global default teleport target - #2714
Conversation
…rget Closes #2225. Adds a `teleportTo` prop on `ConfigProvider` that sets the default Teleport target for every portalled primitive (Dialog, Popover, Tooltip, …). `Teleport` now resolves `to ?? config.teleportTo ?? 'body'`, so individual `*Portal` components can still override it via their own `to` prop. Useful when rendering inside a custom element / shadow DOM. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds a ChangesConfigProvider
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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 docstrings
🧪 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: 1
🤖 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/Teleport/Teleport.test.ts`:
- Around line 87-140: Replace the `@vue/test-utils` `mount` API with
`@testing-library/vue` `render` in both test cases (the test for ConfigProvider
teleportTo default and the test for explicit to prop override). Update the
component mounting pattern to use testing-library's render function and adjust
DOM queries accordingly. For both test cases, add axe accessibility checks after
mounting to verify the Teleport components meet accessibility standards. Update
the cleanup to use testing-library's unmount pattern and ensure all created DOM
containers are properly removed after each test.
🪄 Autofix (Beta)
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
Run ID: 5912366c-513b-4427-9182-42dbae0e4e29
📒 Files selected for processing (4)
docs/content/meta/ConfigProvider.mdpackages/core/src/ConfigProvider/ConfigProvider.vuepackages/core/src/Teleport/Teleport.test.tspackages/core/src/Teleport/Teleport.vue
Closes #2225.
Summary
Adds a
teleportToprop toConfigProviderso apps can set a single default Teleport target that every portalled primitive (Dialog,Popover,Tooltip,Menu, …) inherits — instead of passingtoto each*Portalindividually. This is primarily useful when rendering inside a custom element / shadow DOM.Changes
ConfigProvider: new optionalteleportTo?: string | HTMLElementprop, provided through the config context.Teleport: resolves the target asto ?? config.teleportTo ?? 'body', so:'body'(unchanged default),toon a*Portal→ still wins.ConfigProviderAPI meta for the new prop.Notes
Fully backwards compatible — the
'body'default is preserved whenteleportTois unset.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
teleportToconfiguration option to set a default teleport target for portalled componentsDocumentation
teleportToprop details