Skip to content

Menu with duplicate accelerators always incorrectly selects the first one #13160

Description

@uxmal

Describe the bug

A menu with duplicate accelerators, when navigated with the keyboard, will incorrectly select the first one of the duplicates instead of leaving the menu open, to allow the user to type the accelerator again to select the next item, Enter or space to select the current menu item, or Esc to cancel menu naviagation.

To Reproduce

  1. Create a window with the following menu:
<Menu>
  <MenuItem Header="_File">
    <MenuItem Header="E_xit" Command="{Binding FileExit}" />
  </MenuItem>
  <MenuItem Header="_View">
    <MenuItem Header="_Duplicate 1" Command="{Binding ViewDuplicate1}"/>
    <MenuItem Header="_Duplicate 2" Command="{Binding ViewDuplicate2}"/>
 </MenuItem>
</Menu>
  1. Type Alt+V to bring up the View menu
  2. Type D or Alt+D

Result:

The menu is dismissed and the command bound to Duplicate 1 is executed.

Expected:

The menu to remain open, to allow a possible second D to select Duplicate 2

Environment

  • OS: reproduced on Windows.
  • Avalonia-Version: reproduced on 11.0.4

Additional context

I've attached a zipped VS solution that exhibits the problem.
AvaloniaMenuBug.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions