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

Semantic properties #13

Closed
davidbritch opened this issue Jun 15, 2021 · 0 comments
Closed

Semantic properties #13

davidbritch opened this issue Jun 15, 2021 · 0 comments
Assignees
Labels

Comments

@davidbritch
Copy link
Contributor

davidbritch commented Jun 15, 2021

.NET MAUI introduces semantic properties, which map plat properties to native accessibility properties. This is in addition to the existing AutomationProperties from Xamarin.Forms.

Current semantic properties:

  • Description, of type string
  • Hint, of type string
  • HeadingLevel, of type SemanticHeadingLevel

For more info, see dotnet/maui#469

https://devblogs.microsoft.com/xamarin/the-journey-to-accessible-apps-making-visual-text-accessible/

Additional specs:

dotnet/maui#845
dotnet/maui#927
dotnet/maui#1214

Also, see the internal .NET MAUI accessibility doc.

TabIndex removed
IsTabStop removed

TabIndex and IsTabStop properties were introduced in Xamarin.Forms to help developers control the order in which UI elements would be read by a screen reader. In practice, they ended up being confusing and not meeting that need. In .NET MAUI we recommend a thoughtful design approach that orders your UI as you would want it to be read, rather than looking for programmatic ways to manipulate the structure of your interface. For cases when you must take control over the order, we recommend the community toolkit’s SemanticOrderView which will be available in the .NET MAUI version of the same.

SemanticExtensions class
	SetSemanticFocus method allows you to move screen reader focus to a specific element.
	
	<VerticalStackLayout>
	    <Label
	        Text="Explore SemanticExtensions below"
	        TextColor="RoyalBlue"
	        FontAttributes="Bold"
	        FontSize="16"
	        Margin="0,10"/>
	    <Button
	        Text="Click to set semantic focus to label below"
	        FontSize="14"
	        Clicked="SetSemanticFocusButton_Clicked"/>
	    <Label
	        x:Name="semanticFocusLabel"
	        Text="Label receiving semantic focus"
	        FontSize="14"/>
	</VerticalStackLayout>
	
	private void SetSemanticFocusButton_Clicked(object sender, System.EventArgs e)
	{
	  semanticFocusLabel.SetSemanticFocus();
	}
	
	SemanticScreenReader.Announce in Essentials

cc: @rachelkang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants