Topic was automatically imported from the old Question2Answer platform.
Asked By
JimArtificer
My goal is for the Esc key to work intuitively with my game’s menu system such that pressing it dismisses the top-level window.
I have created a button shortcut keyed off the ui_cancel action that is associated with Esc. As anticipated, pressing the key triggers the button’s pressed signal and performs the function of closing the window.
The problem that I am encountering is that SceneTree.SetInputAsHandled() is not called, so a single key press dismisses all open windows, not just the top-most one.
had a similar problem
‘solved’ it by only setting the shortcut when the dialog becomes active
and storing the ui stack so i can restore shortcuts and focus when ‘active window’ changes