wpf icon indicating copy to clipboard operation
wpf copied to clipboard

PositionInSet and SizeOfSet do not take into account hidden/collapsed elemnts

Open mslukebo opened this issue 1 year ago • 0 comments

Description

Elements that present a collection of items (such as a Menu with MenuItems or a ListView with ListViewItems) do not take into account non-visible elements when calculating PositionInSet and SizeOfSet. This results in screen readers announcing incorrect information.

Reproduction Steps

Create a WPF project that contains one such element. For example, consider the following XAML:

<Window x:Class="BlankWpf.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:BlankWpf"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <ListView Width="500">
            <ListViewItem Content="A" />
            <ListViewItem Content="B" Visibility="Collapsed" />
            <ListViewItem Content="C" />
        </ListView>
    </Grid>
</Window>

Compile this project, open Windows Narrator, and select one of the two visible items in the list.

Expected behavior

When selecting the first item, Windows Narrator should announce "1 of 2." When selecting the second item (C), Windows Narrator should announce "2 of 2."

Actual behavior

When selecting the first item, Windows Narrator announces "1 of 3." When selecting the second item (C), Windows Narrator announces "3 of 3."

Regression?

No response

Known Workarounds

No response

Impact

This is an accessibility issue, since screen readers announce incorrect information.

Configuration

No response

Other information

No response

mslukebo avatar Jan 05 '24 19:01 mslukebo