Provide a way to dismiss menus through AT-SPI2
I'm not sure what is the correct project to file this, so I'm starting here.
When opening a popup menu in a GTK application (for example by right-clicking in a text control), in AT-SPI2 it creates a top-level accessible with the window role, containing an accessible with the menu role. The supported interfaces for the window are IAccessible, IComponent, and ICollection. The supported interfaces for the menu are IAccessible, IComponent, ISelection, and ICollection.
None of these interfaces can provide a way to dismiss the popup menu. The only way I cold find to do it is to simulate an escape keypress. This is acceptable for now, but I'm trying to avoid relying on Xtest as much as possible because I don't think there's a reliable replacement for the functionality on Wayland.
In my testing, menus can otherwise be fully navigated through AT-SPI2, including changing the selection, opening submenus, and activating menu items. There is a minor limitation in that submenus can only be closed by deselecting them, but keyboard navigation can't really close submenus without doing that either.
I am using GTK 3.14.18 on Xubuntu 20.04 in X11. Since menus are dismissed when trying to switch away, I don't know an easy way to test this. The best I've come up with is a command like time.sleep(10); acc.getChildAtIndex(1).getRole()
in Accerciser.