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

Multiple portals with the same target-el don't work properly #61

Closed
stephan-v opened this issue Aug 4, 2017 · 7 comments
Closed

Multiple portals with the same target-el don't work properly #61

stephan-v opened this issue Aug 4, 2017 · 7 comments
Labels
bug postponed We are currently not able to work on this issue and postpone it indefinitely
Milestone

Comments

@stephan-v
Copy link

I am looking for a similar method that you have used here to take elements out of their parent context and move them up in the dom so I can use fullscreen position: absolute elements without having to worry about my element hitting a relative container somewhere.

What I am missing though is having multiple elements point to the same target. I have a couple of components that I might want to display fullscreen. Their display is toggled through a view property in Vuex which decides which particular fullscreen component to display.

With your solution I would have to specify a to and target for everyone of my components though. I do not care about creating a specific placeholder for each components. I simply want to shove them all up in the dom.

Is this still possible with this component somehow or is this is a totally different approach?

@LinusBorg
Copy link
Owner

LinusBorg commented Aug 4, 2017

Hi @stephan-v

Thansk for your request.

If you mean that you want to have mutliple components in one target at the same time, that's actually a duplicate of #26 and will be possible eventually - when if find the time to code it ;)

But to me it sounds like you want to show different sources in the same target, but only one at a time (as it doesn't make sense to have more than one component in fullscreen at the same time).

That's already achievable- you just have to make sure that you only send one source to the portal target at a time, which should be achievable with something similar to this:

<portal target="#outside-dom"  to="some-name" :disabled="!fullscreen">

you can re-use that anywhere as much as you like and re-use the same target.

@stephan-v
Copy link
Author

I can't really seem to get it to work properly:

https://codepen.io/stephan-v/pen/XaNzpP

It simply toggles the components instead of inserting the data in my #widget element. Thanks for your help so far.

If this were to work, it would be perfect for my fullscreen scenario.

@LinusBorg
Copy link
Owner

LinusBorg commented Aug 4, 2017

Hm, that should work, I even have an example in the repo here that does the same, basically:

https://github.com/LinusBorg/portal-vue/tree/develop/example/components/source-switch

Will have to investigate, sorry

@LinusBorg
Copy link
Owner

Ok so I found two things:

  1. Somehow Vue version 2.2.4, which you used, had a problem with this whole thing. Can't say why for the moment.
  2. Appearantly, dynamically re-creating the same portal-target with target-el doesn't work as well as intended.

But once I worked around those two things, I got it working:

https://codepen.io/LinusBorg/pen/eEByOX

I will keep this open as a bug report that target-el has to be fixed to support this. Already have an idea, probably have to check if the target-el element already is a portal-target component, so it doesn't get "overridden".

@LinusBorg LinusBorg added the bug label Aug 4, 2017
@LinusBorg LinusBorg changed the title Multiple components in the same target? Multiple portals with the same target-el don't work properly Aug 4, 2017
@LinusBorg LinusBorg self-assigned this Aug 4, 2017
@LinusBorg
Copy link
Owner

LinusBorg commented Aug 27, 2017

So I tried to fix this, but I really can't figure out why it won't work in the Fiddle. It works well in my local test project (but that uses weback/vue-loader).

I'm thinking about ditching target-el alltogether (in v2) and recommend to mount an instance of PortalTarget programmatically instead. But I'm not sure how many people use this.. :/

@LinusBorg LinusBorg removed their assignment Aug 27, 2017
@LinusBorg LinusBorg added the postponed We are currently not able to work on this issue and postpone it indefinitely label Aug 27, 2017
@LinusBorg LinusBorg added this to 1.3 in Roadmap Sep 22, 2017
@LinusBorg LinusBorg moved this from 1.3 to v.2.0 in Roadmap Sep 22, 2017
@LinusBorg LinusBorg modified the milestone: 2.0.0 Sep 4, 2018
@LinusBorg
Copy link
Owner

Will be solved with #139

@LinusBorg
Copy link
Owner

Done in next branch for 2.0.0, will release an alpha this week.

Won't be fixed in 1.*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug postponed We are currently not able to work on this issue and postpone it indefinitely
Projects
None yet
Development

No branches or pull requests

2 participants