You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem Description
The current behavior of the key listener does not align with standard keypress event scoping expectations. Specifically:
When the behavior is attached to a control (e.g., an Entry), only that control should receive the keypress events.
Sibling controls or controls outside the visual scope should not receive these events.
Parent elements in the visual tree should receive the events only if the event is not marked as handled (e.Handled = true).
Keyboard events should bubble up the visual tree, following standard event routing patterns.
Expected Behavior
Keypress events should be scoped to the VisualElement the behavior is attached to, and optionally bubble up to its parent elements. The behavior should not act as a global key event listener where all controls receive all keypresses indiscriminately.
Core Requirements
Keypress events must be routed to the attached control and optionally bubble up.
The behavior must respect event handling (Handled = true) to prevent further propagation.
When multiple behaviors are present, each should receive only the events relevant to its scope.
Ask
Please scope the keystroke handling appropriately, especially in scenarios where multiple behaviors are used. The current implementation behaves like a global listener, which breaks encapsulation and expected UI behavior.
Reproduction
To reproduce the issue, open the KeyListener sample project and replace the contents of MainPage.xaml.cs with the following code:
using Plugin.Maui.KeyListener;
namespace Plugin.Maui.KeyListener.Sample;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
Problem Description
The current behavior of the key listener does not align with standard keypress event scoping expectations. Specifically:
Expected Behavior
Keypress events should be scoped to the VisualElement the behavior is attached to, and optionally bubble up to its parent elements. The behavior should not act as a global key event listener where all controls receive all keypresses indiscriminately.
Core Requirements
Ask
Please scope the keystroke handling appropriately, especially in scenarios where multiple behaviors are used. The current implementation behaves like a global listener, which breaks encapsulation and expected UI behavior.
Reproduction
To reproduce the issue, open the KeyListener sample project and replace the contents of MainPage.xaml.cs with the following code:
using Plugin.Maui.KeyListener;
namespace Plugin.Maui.KeyListener.Sample;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
}
Replace MainPage.xaml with:
Run the app and focus on one Entry. Typing will trigger both KeyDown handlers, even though only one Entry has focus.
Running it and typing while focused on one entry control will call all of the listeners, not just the scoped entry control.
Here is a Recording of it (Note Testing was done on Windows).
KeyboardScopeIssue.mp4