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

proof of concept: phx-portal #3478

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

proof of concept: phx-portal #3478

wants to merge 1 commit into from

Conversation

SteffenDE
Copy link
Collaborator

This is a proof of concept PR implementing a new phx binding called phx-portal. This binding allows to designate an element to be rendered at another location in the DOM, designated by the ID that phx-portal points to. This can be useful to render things like dialogs at the top layer, outside any containers that might affect their rendering (e.g. overflow: hidden).

Nowadays there is also the Popover API and native <dialog> elements, so this might not be that important any more.

Because of this, I also don't feel like this is something we really want to support. This PR only shows how it could be implemented.

This is a proof of concept commit implementing a new phx binding called
`phx-portal`. This binding allows to designate an element to be rendered
at another location in the DOM, designated by the ID that `phx-portal`
points to. This can be useful to render things like dialogs at the top
layer, outside any containers that might affect their rendering (e.g.
overflow: hidden).

Nowadays there is also the Popover API and native `<dialog>` elements,
so this might not be that important any more.

Because of this, I also don't feel like this is something we really want
to support. This commit only shows how it could be implemented.
@greven
Copy link

greven commented Oct 21, 2024

Hey @SteffenDE,

I think this is a worthy addition, even with the upcoming Dialog API. Even though the Dialog API usage is already at 95%, there are use cases where a portal is needed outside of a dialog usage, anything that we need to break out of its container layout.

Now, my only doubt is if this should be user-land, but I would be perfectly happy to have it built-in. :)

@tmjoen
Copy link
Contributor

tmjoen commented Oct 24, 2024

I would love this to simplify "forms within forms". Say for instance you have a multi-select component in a form and you want to be able to create options from within the component using another predeclared form (which is our use case). Would this work for that? That's at least how we used Vue Teleport before migrating to Live View.

@AlexKovynev
Copy link

will be great to have this in 1.0 release. This is very necessary feature with which modals can finally will be live! :)

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.

4 participants