GtkDialog buttons don't wait for key up before emitting clicked
Steps to reproduce
When using a GtkDialog, the buttons can be clicked either with the mouse or with the enter or space bar. According to the docs, the "clicked" event of a button represents a press and release. For the mouse, this works as expected; clicking and holding the button shows it in the pressed position, but the "clicked" signal doesn't fire until the mouse button is released. With the keyboard, however, this is not the case. When the space bar or enter key is pressed and held, the "clicked" signal fires immediately. The GtkDialog is then destroyed, the window behind it regains focus, and once the key is released, a key-release signal is sent to the window behind it.
Small reproducer application attached. Try clicking and holding the example button with the mouse, then try pressing and holding with the space bar.
Current behavior
GtkDialog buttons emit "clicked" signal on keyboard button down.
Expected outcome
GtkDialog buttons should emit "clicked" signal only once the keyboard button up event happens.
Version information
GTK version: 3.24.30+62+g8d04980f-1
Manual build with options: -D broadway_backend=true -D cloudproviders=false -D tracker3=false -D colord=yes -D gtk_doc=false -D examples=false -D demos=false -D man=true
Linux distro: Arch Linux