CollisionObject2D mouse signal not working after exiting UI

Godot Version

4.3

Question

` I have a StaticBody2D which can instantiate a interface, it checks if the player is within an acceptable range and has the mouse hovering when a click occurs.

I have a variable called mouseHovering: bool which keeps track if the player’s mouse is on top of the StaticBody2D.

var mouseHovering: bool:
	set(newValue):
		mouseHovering = newValue
		print(str(mouseHovering))

func mouse_entered() -> void:
	mouseHovering= true

func mouse_exited() -> void:
	mouseHovering= false

“If I click a static object to open an interface, keep my mouse still, and press escape to exit, mouseHovering becomes true again. However, if I click, mouseHovering briefly turns false before switching back to true. Is there a way to prevent this?”

I’ve tested and the main problem stems from the mouse hovering a panel node which has its mouse filter being set to “stop” but I can’ turn that off as this would cause problems. `