Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(portal): add configurable portalTarget support #3688

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from

Conversation

menthol
Copy link

@menthol menthol commented Mar 26, 2025

πŸ”— Linked issue

Resolves #3687

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Introduced a portalTarget option in UApp to specify portal mounting targets across various components. Updated portals in components like ContextMenu, Drawer, Tooltip, and others to respect portalTarget. Default target is set to body.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link

pkg-pr-new bot commented Mar 26, 2025

npm i https://pkg.pr.new/@nuxt/ui@3688

commit: 6c95b90

@menthol menthol force-pushed the v3 branch 2 times, most recently from 0d6145e to 11d2cdc Compare March 26, 2025 07:15
Copy link
Member

@benjamincanac benjamincanac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I would put this config in global app.config but instead put it in the portal prop of each component as an object with the to and disabled fields. It would be more consistent and would allow configuration per component.

Copy link
Author

menthol commented Mar 26, 2025

I've tried, and Implementing a system using a component-based configuration proved to be significantly more challenging than anticipated. The process required meticulous definition of the target for each individual component, leading to a highly time-consuming and cumbersome configuration process. This level of detail, while potentially offering great flexibility, introduces a substantial overhead.

A potential solution to mitigate this complexity might involve a hybrid approach: employing a global configuration file to establish baseline settings, while allowing for component-specific overrides where necessary. This would reduce the repetitive nature of defining targets for every component, simplifying the overall configuration management.

Copy link
Member

Then I would still not put it in App Config but as a prop on UApp that is provided to all components maybe?

@menthol
Copy link
Author

menthol commented Mar 26, 2025

This is a great idea.

@menthol menthol force-pushed the v3 branch 4 times, most recently from 2d6b07a to 566e49b Compare March 26, 2025 19:27
@menthol
Copy link
Author

menthol commented Mar 26, 2025

Is this the direction you had in mind?

@menthol menthol requested a review from benjamincanac March 27, 2025 15:38
@menthol menthol force-pushed the v3 branch 5 times, most recently from 170b6fe to 9131e60 Compare March 31, 2025 18:02
@benjamincanac benjamincanac added the v3 #1289 label Apr 4, 2025
Introduced a `portalTarget` option in `UApp` to specify portal mounting targets across various components. Updated portals in components like `ContextMenu`, `Drawer`, `Tooltip`, and others to respect `portalTarget`. Default target is set to `body`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 #1289
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow specify portal destination for all portaled components
2 participants