godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.47k stars 20.25k forks source link

Buttons do not return to normal state after press is released #94341

Open spkellydev opened 2 months ago

spkellydev commented 2 months ago

Tested versions

Godot 4.2.2

System information

Windows 10 - Godot 4.2.2

Issue description

created a dummy theme, added my button states. When I press a button, the pressed state is enabled. After releasing the mouse, the button stays in PRESSED DrawMode. The only way to return a button to NORMAL state is to ...click another button? Is this intended behavior? Toggle mode is not enabled. I have looked at a few YT tutorials on Godot themes and looked at the docs, every example of theming buttons has this issue as far as I can see. Is there a recommended way to return buttons to NORMAL state other than needing another button?

Steps to reproduce

Click a button and release the click. Button will stay in the PRESSED state

Minimal reproduction project (MRP)

buttons.zip

AThousandShips commented 2 months ago

Please try with a supported version like 4.1.4 or better 4.2.2

spkellydev commented 2 months ago

Ah, my mistake. I thought v4.1.3.stable.official was a supported version

spkellydev commented 2 months ago

The same reproducible produces this undesired behavior in v4.2.2

spkellydev commented 2 months ago

I did not realize buttons were Focused by default in Godot which is why I perceived this as a bug (also my example uses the same style for Press and Focused 🤦‍♂️). Changing the Focus Mode to None produces the buttons I was expecting (also this explanation is completely absent from the documentation). My mistake!

AThousandShips commented 2 months ago

also my example uses the same style for Press and Focused

This would be a big part of the problem (and that part is clearly documented as bad practice)

Maybe we can add some further notes about the draw mode with respect to focus, but as long as focus visuals are set up properly this shouldn't be a problem