Interactive components not working when nested inside a main component

Still not working. @Jordan_Romanoff described it nicely — mouse enter / mouse leave / while hovering doesn’t work if nested inside another component. :frowning_face:

2 Likes

This happened to me. The fix was to use the instance of the master that contains the nested interactive component.

Basically if this is done inside a master, and that master shows an interactive component’s instance, the instance refuses to react.

1 Like

Not sure I do understand the fix. Can you elaborate more? Can you give an example?

@Marko_Kosovic I just went through something similar, I think I can help explain.

Interactive components seem to work as expected when they are within an instance of a component but not when they are within a main (master) component. So if your prototype includes instances of components instead of main components, they should work.

2 Likes

@Jayna_Moloney Thank you for clarifying. That goes without saying.
Playing prototypes doesn’t work without having regular frames, so you have to use instance any way.

But seems like it doesn’t work in some specific pages in the way you described either…
And I was experiencing the same issue with library import.

When I create a new file, it does work!
But as mentioned before by @Constantine_Zuev , it’s buggy and unpredictable.
Even if you turn on/off “Enable interactive components” some pages have the same bug.

I have come across a similar issue. I have made an interactive dropdown. It works fine when it’s not a component, but as soon as I make it in to a component, and then make an instance of that component, the interactive behaviour causes the Figma prototype to crash.

As a tip for anyone else reading here, I have managed to work around it for now by making the master component have a non-interactive variant of the interactive component in it, then switching to the interactive variant in the instance. But this is not ideal!

Try moving your components and screens to new page. This worked for me.

Exactly the answer I needed! Thanks, it worked!

Same issue for me, giving me “nested instance is swapped with its parent instance” error when playing the prototype, if they aren’t parent/child then prototyping between them specifically - change “on tap”/“on click” does work, but if they are connected it does not. I wish there was a fix for this. I don’t want to have to change every button variant individually, I like them linked so when I make mass changes it changes everywhere cause I auto-layout all of my designs. Frustrating. Moving to another page did not help.

1 Like

This is a separate issue, if you pasted it from another file, try checking if they have nested variants other then original. As described here:

Parent component - the original component you made - the very first one, before you copied it and created a component out of that it (the child component).

When you inspect the layers you will see the single blue diamond outline icon inside a component (4 mini diamond in diamond shape) you made, meaning you did not detach the instance. The new component you made has the parent inside of it (since it’s copy of a parents that has been turned into component without detaching instance).

So what you want to do is keep the parent (the original component) on it’s own, do not combine it as a variant. Instead copy it as many versions as you need to make - make modifications and turn them each into a component and then combine “the child” components. You can not combine parent with child (parent inside child), so all variants need to be children, combine child (parent inside) with child (parents inside). Does that make sense? Take a look at the link in this file at the layers construction (one is the issue and the other is the solution): Figma

7 Likes

Thank you for this detailed reply!

1 Like

Thanks, Kevin, this workaround works.

Hey @Anastasia_Stallcop, thanks for your comment. It looks like it is the right way to go. In my case, however, the combined components (variants) never worked on the page I have the components. What I had to do was to duplicate the design page where I had the issue and then it worked. I am happy I found a way to fix the issue but the fact that I dont understand why it doest not work really annoys me
.

It is been a while since i started this topic, and at this moment my workflow switched around this problem.

Main thing i understood is that there is no much reason to use main components in your production pages.

In my average wroflow. i created components nested with other components as needed, and then store them in pages following the Atomic Design theory.

Then i grab instances of whatever i need and use them in the layout pages (where i put all the pieces of the screen toghether)

That way i make sure everything is an instance (so main components are safe), and also that everything is interactive.

It also helps into some popular interaction bugs, but that is for another topic.

But to put a solution on this topic: “For some reason, no, Interactive instances does not work inside a main component. They work when the main component is an instance as well. Try figuring out another workflow, that not requires main components to be inside production pages. (which in my oipinion is also a bit dangerous)”

1 Like

This issue has not been solved. I created an auto layout that expands out. This works fine on its own and also when I turn it into a component. As soon as I create an instance of that component, the interaction of the expanding auto layout DOES NOT WORK. This bug has been around for a really long time apparently and it’s still not fixed??

2 Likes

this is really annoying. please fix.

example file?

https://file.io/6Nk9xO5gjn5o

sample file that shows the bug
open overlay doesnt work in variant2, when opened

other file host