Skip to content

Menu items do not have position information when created via ItemsSource #10100

Open
@xj-ms

Description

@xj-ms

Description

When a menu is populated with menu items in XAML, Windows Narrator can get the position info of each menu item and will announce them when focused.

However, when the menu items are generated from ItemsSource. The narrator won't be able to get position info and therefore won't announce it

<!-- This works -->
<Menu>
  <MenuItem Header="A" />
  <MenuItem Header="B" />
  <MenuItem Header="C" />
</Menu>

<!-- This doesn't. ItemHeaders can be a list of strings -->
<Menu ItemsSource={Binding ItemHeaders} />

More specifically, MenuItemAutomationPeer throws exceptions in GetPositionInSet and GetSizeOfSet if ItemsSource is used.

Reproduction Steps

  1. Create a menu with ItemsSource bound to a collection of string
  2. Run the application.
  3. Run Windows Narrator
  4. Tab over the menu items

Expected behavior

The narrator should announce the header of a menu item as well as its position, e.g. 3 of 5

Actual behavior

Only the header is announced by the narrator

Regression?

No response

Known Workarounds

No response

Impact

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    AccessibilityAn issue related to accessibility enhancements or blockers.InvestigateRequires further investigation by the WPF team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions