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

Propagate semantics to CV Item container #7539

Merged
merged 2 commits into from
Jun 2, 2022
Merged

Conversation

PureWeen
Copy link
Member

Description of Change

If you don't set the AutomationProperties on the root element of a templated ListViewItem in WinUI then it just reads out the class type on Narrator. In order to read out something useful the guidance is to set the AutomationProperties of the root element. This PR propagates the semantic properties set on the root xplat element to the ContentControl that acts as the root container for the WinUI CV.

Example Usage

new CollectionView()
{
	ItemsSource = new int[] { 1, 2, 3, 4, 5 },
	ItemTemplate = new DataTemplate(() =>
	{
		var layout = new StackLayout()
		{
			new Button()
			{
				Text = "Whatever"
			}
		};

		SemanticProperties.SetDescription(layout, "Hello there");
		return layout;
	})
};

@PureWeen PureWeen added this to the 6.0.3xx-sr1 milestone May 27, 2022
@Eilon Eilon added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label May 27, 2022
{
// If you don't set the automation properties on the root element
// of a list item it just reads out the class type to narrator
// https://docs.microsoft.com/en-us/accessibility-tools-docs/items/uwpxaml/listitem_name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we consider changing the default too? So that if a developer doesn't explicitly set a description, it'll still make sense?

Maybe we can do something similar to image where it simply can't receive focus at all and won't read out anything - maybe we can make it so just the contents are accessible?

Or alternatively, we can try to make the textual contents or at least the first textual content get propagated upward

{
// If you don't set the automation properties on the root element
// of a list item it just reads out the class type to narrator
// https://docs.microsoft.com/en-us/accessibility-tools-docs/items/uwpxaml/listitem_name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we consider changing the default too? So that if a developer doesn't explicitly set a description, it'll still make sense?

Maybe we can do something similar to image where it simply can't receive focus at all and won't read out anything - maybe we can make it so just the contents are accessible?

Or alternatively, we can try to make the textual contents or at least the first textual content get propagated upward

Copy link
Member

@rachelkang rachelkang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as a first step!

works as expected on Recipes as well :)

@rachelkang
Copy link
Member

failing tests unrelated

@rachelkang rachelkang merged commit 2930580 into main Jun 2, 2022
@rachelkang rachelkang deleted the fix_cv_item_accessibility branch June 2, 2022 15:34
@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants