Button is being triggered by spacebar after clicked once.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By NoIE

Hello.

Button is being triggered by spacebar after clicked once.

How to avoid it?

Or how to avoid button getting focus?

Thanks.

This is because spacebar is assigned to ui_accept and ui_select in the input maps by default
One of this causes the button to press when space is pressed

Remove space from the input map

Dreaming | 2021-10-26 00:02

:bust_in_silhouette: Reply From: zdimaria

You can do:

button.release_focus()

and then space bar will no longer click it.

Thank you very much!

NoIE | 2018-04-04 19:38

Now my button press animation doesn’t play.

wetbadger | 2021-05-05 22:54

:bust_in_silhouette: Reply From: Erich_Lamontagne

Go to Project Settings → Input Map and remove the space bar from ui_accept.

:bust_in_silhouette: Reply From: paacardoso

If does not work, check this link:
https://forum.godotengine.org/50543/press-button-then-space-presses-button-how-can-prevent-that