Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObservableCollection DataContext in ListViewItem accessibility issue #9804

Open
vsfeedback opened this issue Sep 18, 2024 · 4 comments
Open
Assignees
Labels
📭 waiting-author-feedback To request more information from author.

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


Hi
When Listview control in WPF binds to observable collection datasource , accessibility read out the type of observable collection type class instead of the listviewitem contents while navigation from keyboard up or down arrow keys.


Original Comments

Feedback Bot on 9/11/2024, 07:11 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Ann Yang [MSFT] on 9/11/2024, 00:03 PM:

Thank you for taking the time to log this issue!
In order to help us better understand this scenario, could you attach a video of the issue you describe using [ScreenToGif] ( https://www.screentogif.com/) or a similar tool? We hope we can learn the actual result and the expect result which you want from the video.
It would be appreciated if you could attach a demonstration project in your video.
We are looking forward to hearing from you soon.
Thanks

Rajat Gupta on 9/11/2024, 06:45 PM:

(private comment, text removed)

Feedback Bot on 9/12/2024, 11:59 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

@pchaurasia14 pchaurasia14 changed the title WPF OBSERVABLE COLLECTION DATCONTEXT IN LISTVIEWITEM PROBLEM FOR ACCESSIBILITY ObservableCollection DataContext in ListViewItem accessibility issue Sep 18, 2024
@miloush
Copy link
Contributor

miloush commented Sep 18, 2024

A repro project would be helpful.

@harshit7962 harshit7962 added the Investigate Requires further investigation by the WPF team. label Sep 23, 2024
@himgoyalmicro
Copy link
Contributor

You need to explicitly set the AutomationProperties.Name for ListViewItem inside ListView.

<ListView.ItemContainerStyle>
    <Style TargetType="ListViewItem" BasedOn="{StaticResource DefaultListViewItemStyle}">
        <Setter Property="AutomationProperties.Name" Value="{Binding Name, Mode=OneWay}"/>
    </Style>
</ListView.ItemContainerStyle>

Let us know if this resolves your issue.

@himgoyalmicro himgoyalmicro added 📭 waiting-author-feedback To request more information from author. and removed Investigate Requires further investigation by the WPF team. labels Sep 23, 2024
@TheQuinbox
Copy link

hi @himgoyalmicro,
I wouldn't call this a solution. In my mind this is still a bug, the semantic information given to screen readers by default should be as good as possible IMO. Giving the name of the class is incredibly unhelpful, while giving the text of the item is incredibly helpful and standard behavior across Windows.
Thanks.

@himgoyalmicro
Copy link
Contributor

Hey @TheQuinbox
Yeah, the fix I provided earlier was indeed a workaround. After a more in-depth investigation, I discovered that we need to override the ToString function for the ListItem class. Otherwise, AutomationPeer will use the default Object.ToString, which will result in the type of the observable collection class being returned.

Without overriding the ToString function:

Image

With overriding the function:

Image

Here is a minimal sample repro:
ListViewItemAutomationPeer.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📭 waiting-author-feedback To request more information from author.
Projects
None yet
Development

No branches or pull requests

5 participants