Description
Describe the bug
PopoverMenu
does not receive any key that is handled in the underlying view.
Example
When a PopoverMenu
is open, pressing the Up or Down arrow keys first moves the cursor in the next focused view (the underlying view? 🤔), rather than navigating through the context menu items.
To Reproduce
Steps to reproduce the behavior:
- Open the Notepad scenario in UICatalog
- Add several lines of text to the editor
- Right-click on tab title to show context menu
- Press up repeatedly, then down repeatedly
Expected behavior
Arrow key input should be captured by the context menu immediately, moving the selection within the menu. The underlying text view should not respond to keyboard input while the menu is visible.
Actual behavior
Arrow key presses affect the underlying text view (e.g., moving the caret), and only afterward begin navigating the menu.
Perhaps this is by design, but I'm unsure how to work around it.
Another Example
Desktop:
- OS: Windows 10.0.26100
- WindowsDriver
Additional Context
This also has the effect of disabling keys for the PopoverMenu
if they are handled by the underlying view.
For example, if you add the following code to the TextView in Notepad.cs, you will be unable to move up or down in the context menu using up/down arrows:
protected override bool OnKeyDown(Key key)
{
if (key == Key.CursorUp || key == Key.CursorDown)
{
return true; // handle key event
}
return base.OnKeyDown(key);
}