Skip to content

Keys Not Captured first by PopoverMenu; Input falls through to underlying view #4174

Open
@YourRobotOverlord

Description

@YourRobotOverlord

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:

  1. Open the Notepad scenario in UICatalog
  2. Add several lines of text to the editor
  3. Right-click on tab title to show context menu
  4. Press up repeatedly, then down repeatedly

Image

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

Image

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions