Clicking a control also clicks the button behind it even when mouse_filter is "stop"

Godot Version

4.3

Question

I have some modals overlaying a level selection screen.
When clicking anything in the modal, for example a LineInput, ItemList or whatever it may be, it passes to the TextureButton in the level selection, hidden behind the modal and starts that level.
This happens even though each control has mouse_filter set to “stop”.

Structure is something like this:

LevelSelection # root
  >  LevelSelectionButtons
    > TextureButton1 # These are clicked even though hidden behind the modals
    > TextureButton2
  > Modals # ColorRect overlaying the entire screen
    > ModalScreen1 
      > ItemList
    > ModalScreen2
      > LineInput
  > BottomControls
    > ButtonModalScreen1
    > ButtonModalScreen2

You should try separating the buttons that can overlap/overlay on to separate canvas layers.

They are both control nodes.

When mouse_filter is set to “STOP” it’s not supposed to pass to another control node behind.

Correct me if that is wrong please.

It just stops the propagation of the input event once received.

The problem here was that even though the modals have a higher Z-index, they were actually considered behind the level selection layer.

Thank you @pennyloafers for trying to help!

1 Like