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

v-bind style not working in some edge cases (teleport + transition, slots) #7312

Open
theoephraim opened this issue Dec 9, 2022 · 7 comments · May be fixed by #7344 or #7364
Open

v-bind style not working in some edge cases (teleport + transition, slots) #7312

theoephraim opened this issue Dec 9, 2022 · 7 comments · May be fixed by #7344 or #7364
Labels
has workaround A workaround has been found to avoid the problem 🐞 bug Something isn't working

Comments

@theoephraim
Copy link

theoephraim commented Dec 9, 2022

Vue version

3.2.45

Link to minimal reproduction

https://sfc.vuejs.org/#eNqdVM1uozAQfpVZX9JKAe7ZNNo97HX3sL1U4kJgkrgF2xoPSaso796xoYQ2KFV7Qcx4vp/5kDmq386l+xbVQi0ZG1cXjKvcACzXLbM18Kusdfl0lyu/s4f7nTZbuIMfQ5Gr1b3dbmsEDuUy62A9BWWr+AhV7FR6D2VdeC+EjM8s8NAHMBaYCuM1a2vmscQanSWOuEyAZ5bzZI+e4IV9ojdj24MUwMOf/+/U/v57pzbWW2YfxHKTsyTVTQNbkVjb6mVg/44VrANZ52NQm3DSqw5BfOrlIqgv+7sMq3c8SmvsciKxS+OfJ3i2O7HCN5a4vgYkcNC8AyGiAgL3gQrnkEaKow0ndrz6oUJjuFlS+pK0Y/DIrZOObqKHIxBu4AQbsg3M5ErOOnRpjWcobW1Jbp7M3MwIq9nt28n4XoZTphZvfwbVTqfX5Jc6yKchLTgG6ki5kNzW2lQ3sQq4U4TGcTVXnbmkKVz66K2R30TE5v2Bz9WiYws9MR3qXO2YnV9kmd+U4efy6FNL20zeUmoN6wZT9E2yJnvwSEKcq/mII5PmHikhNBWSfIUrnB9GL3gDrWx0UqdXm5CifQ==

Steps to reproduce

click the toggle button off and on

What is expected?

all text should be red

What is actually happening?

using v-bind inside of a teleport inside of a transition fails. It does actually work if there is an extra div wrapper around the transition. However in a case where a v-if transition is being triggered because the parent component has been unmounted, this will not work.

System Info

No response

Any additional comments?

see #4605 and 42239cf


For anyone encountering this bug in the meantime

a workaround is to inject your own css var with [@vueuse/head]. In my case there was only one of the component at a time, but you could easily generate a unique name...

useHead(
  computed(() => ({
    style: [{ children: `:root {--my-special-css-var: ${myVar}; }` }],
  })),
);
@theoephraim theoephraim changed the title v-bind style + teleport + transition v-bind style not working inside teleport + transition Dec 9, 2022
@edison1105 edison1105 added 🐞 bug Something isn't working has workaround A workaround has been found to avoid the problem labels Dec 10, 2022
@moushicheng
Copy link
Contributor

moushicheng commented Dec 13, 2022

It's not just the problem of transition components,
see here,playground

@theoephraim
Copy link
Author

@moushicheng - Thanks for adding this. Im not surprised... It seems to have to do with not finding an actual parent node to attach the inline style to.

@theoephraim theoephraim changed the title v-bind style not working inside teleport + transition v-bind style not working in some edge cases (teleport + transition, slots) Dec 13, 2022
@edison1105
Copy link
Member

This is because Teleport is not patched in the fast path.
Maybe we should re-consider the solution in #4609

@baiwusanyu-c baiwusanyu-c linked a pull request Dec 14, 2022 that will close this issue
@baiwusanyu-c
Copy link
Member

This is because Teleport is not patched in the fast path. Maybe we should re-consider the solution in #4609

I made some modifications based on your pr(#4609 ), and I may need your help in some places. In addition, for the implementation of CSSVars in teleport, I think it really needs further consideration

paescuj added a commit to directus/directus that referenced this issue Aug 18, 2023
Unfortunately, modifiying the font via css var doesn't work so we need
to pass it down via prop. See vuejs/core#7312
paescuj added a commit to directus/directus that referenced this issue Aug 18, 2023
Unfortunately, modifiying the font via css var doesn't work so we need
to pass it down via prop. See vuejs/core#7312
DanielBiegler pushed a commit to directus/directus that referenced this issue Aug 21, 2023
* temp commit

* change to non translated names

* Add changeset

* Fix linter warning

* Update related collection selection as well

Unfortunately, modifiying the font via css var doesn't work so we need
to pass it down via prop. See vuejs/core#7312

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
sethkaufee pushed a commit to sethkaufee/directus that referenced this issue Sep 20, 2023
* temp commit

* change to non translated names

* Add changeset

* Fix linter warning

* Update related collection selection as well

Unfortunately, modifiying the font via css var doesn't work so we need
to pass it down via prop. See vuejs/core#7312

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
@Swivelgames
Copy link

Here's another playground for you.

@alkami-jdalrymple
Copy link

alkami-jdalrymple commented Oct 19, 2023

Is there a reason why these vars aren't just hoisted to :root? If they're made adequately unique, there shouldn't be any fear of unintentionally overwriting existing vars, should there?


but you could easily generate a unique name

I actually ended up trying your method here, but making them unique required being able to refer to them uniquely inside my <style scoped> 😅

I'm exploring some other workarounds, but so far no dice! This is turning into a major blocker, unfortunately 😞

At this point, we're exploring rolling our own <DynamicTransition>, but I have a feeling that's going to get really messy.

br-rafaelbarros pushed a commit to personal-forks/directus-source that referenced this issue Nov 7, 2023
* temp commit

* change to non translated names

* Add changeset

* Fix linter warning

* Update related collection selection as well

Unfortunately, modifiying the font via css var doesn't work so we need
to pass it down via prop. See vuejs/core#7312

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
@Rusinas
Copy link

Rusinas commented Nov 9, 2023

Same problem here :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has workaround A workaround has been found to avoid the problem 🐞 bug Something isn't working
Projects
None yet
7 participants