GtkMenu created from GMenuModel does not deactivate menu when activating a menu item with Space
@chpe
Submitted by Christian Persch Link to original bug (#788844)
Description
An item in a GtkMenu can be activated by several means, i.e. from mouse with a left click, or from keyboard by pressing Return, Enter, or Space.
When the menu is built the old-fashioned way, that is either manually by creating the menu with gtk_menu_new() and then creating the menu items with gtk_*_menu_item_new() and adding them to the menu with gtk_menu_shell_append(), or by creating the menu from GtkUIManager XML format, the activation of a (non-check) menu item causes the deactivation of the menu.
However, when you build the menu with gtk_menu_new_from_model(), the activation of the menu item with Space does NOT cause the deactivation of the menu.
At first, this seems only unexpected and surprising, but in my case this presents a real bug: When the activation of the menu (/ the GAction) causes a new window to be created (for example in gnome-terminal's File|Open Terminal item or its context menu's Open Terminal item), what happens is that the new window (shown with gtk_window_present_with_time) opens under the still-open context menu, however the menu does not react to mouse movements anymore, and you have to dismiss it manually by clicking outside of it (it still reacts to the keyboard though).
AFAICT, the cause bug of this is that check menu items special-case activation by Space to 'toggle' the menu item, and behind the scenes, all menu items created by gtk_menu_new_with_model are check menu items.
Version: 3.22.x