This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Ondrej Rohoň
Posted Jul 22 - Read on Facebook

Hey guys, when having two layers on top of each other, first one with lower index is listening to touch events, the second one is on top of the first one, covering it and not listening to any touch event. When I tap the second layer, I still get touch event of the first layer. Is this bug? How do I prevent this behaviour? Do I have to set ignoreEvent of the first layer to true? Hope I made my self clear. Thanks for help. Here is an example:

10 Comments

Jordan Robert Dobson

SecondLayer.ignoreEvents = false

Jordan Robert Dobson

Or just do secondLayer.on Events.TouchStart, -> # do nothing

Ondrej Rohoň

Yes, this solution works for me, but isn't this behaviour by default weird?

Jordan Robert Dobson

No. Not to me. Events should pass through if the one in front doesn't accept them.

Jordan Robert Dobson

By default all layers ignoreEvents unless you add one to it.

Ondrej Rohoň

Thanks for your explanation. To me it seemed natural, that layer in the front will "cover" the one that listens to the events. It works like this with typical html and js. When you listen for example for clicks on some div and another absolutely positioned div covers part of it, that part won't be clickable. It probably makes sense if the layer that covers clickable one is it's child, then it should pass through events. But that's just my opinion. Thanks again.

Jordan Robert Dobson

This is all html and JS... so I guess it doesn't always work that way. I wonder what property they are toggling. probably pointer-events in CSS.

Ondrej Rohoň

Yes, it is html, css, js, that's the reason it surprised me. I have to make a quick example with iOS native UIViews and UIKit as well, if it also passes through all of the events. I'm quite curious, but my guess would not pass those events.

Melvin Eudell Hogan

One thing I've noticed in this situation is layers with transparent backgrounds can cause wonkiness with events.

Jordan Robert Dobson

Mel - do you have an example?

Read the entire post on Facebook