[Linux x64 - Wayland] KeyDown event in child modal window "leaks" into the parent window
Author: mihnea-radulescuCreated Aug 8, 2026Updated Sep 15, 2026
Labelsbug
Describe the bug
In the Linux Wayland implementation (Avalonia.Wayland), a KeyDown event in a child modal window, such as a message box:
- is processed by the child modal window
- the child modal window has been closed
- the KeyDown event "leaks" into the parent window, where it is processed again
This issue happens only with the Linux Wayland implementation, the Linux X11 implementation works correctly. It occurs with either custom KeyDown event handlers, or built-in KeyDown event handlers, such as Button.IsCancel or Button.IsDefault, tested under the Gnome 50 and KDE Plasma 6.5.4 desktop environments.
To Reproduce
The minimal repro project attached reveals the problem:
- in Linux Wayland, pressing Esc in ParentWindow, and then Esc again in MessageBox, results in an infinite loop of MessageBox instances opening up
- in Linux X11, pressing Esc in ParentWindow, and then Esc again in MessageBox, correctly results in the MessageBox instance closing, and then ParentWindow closing as well
Expected behavior
A KeyDown event occuring in a child modal window should not propagate to the parent window, after the child modal window has been closed.
Avalonia version
12.1.1
OS
Linux x64 - Wayland
Source: AvaloniaUI/Avalonia