Skip to content

Fix BaseButtons remaining pressed when hiding while pressed down

Created by: leonkrause

When a BaseButton is pressed down while being hidden (itself or one of its parents), it will remain pressed down. This easily leads to unexpected behavior when doing something like:

func _process( delta ):
    if is_pressed():
        get_parent().hide()
        print( "Pressed & hidden!" ) # will be called every frame after pressing

For more info see https://github.com/okamstudio/godot/issues/2496#issuecomment-142167856 and this forum post. This change "unpresses" the button when hidden. Closes #2496 (closed). Depends on pull request #2533.

Merge request reports