Skip to content

popupMenu: Avoid intermediate focus changes on menu switch

Carlos Garnacho requested to merge wip/carlosg/popup-logic into main

Currently when switching from a popup menu to another in the same manager, we first show the new menu, then hide the old menu and remove its grab, then create a new grab for the just shown menu.

This briefly ungrabbed moment will still trigger keyboard focus changes, that might have other visible effects. In order to fix this, change the grabbing order so first the new grab is created then the old one is dismissed. This ensures focus moves from the old menu to the new menu without gaps in between.

Since a grab is tied to an active menu, but close/grab are now slightly decoupled, also ensure closing a menu only tears down its own grab. This is necessary for correct accounting while doing the grab shuffling.

Closes: #5039 (closed)

Edited by Carlos Garnacho

Merge request reports