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

[Spec] Implement LabeledBy property for accessibility #845

Closed
Tracked by #22
rachelkang opened this issue Apr 26, 2021 · 1 comment
Closed
Tracked by #22

[Spec] Implement LabeledBy property for accessibility #845

rachelkang opened this issue Apr 26, 2021 · 1 comment
Assignees
Labels
area-controls-label Label, Span legacy-area-a11y Relates to accessibility proposal/open t/a11y Relates to accessibility t/enhancement ☀️ New feature or request

Comments

@rachelkang
Copy link
Member

rachelkang commented Apr 26, 2021

Implement LabeledBy property for accessibility

Recreate a property that is reminiscent of the Xamarin.Forms AutomationProperties.LabeledBy property.

And make sure there is an implementation for iOS.

API

SemanticProperties.LabeledBy

Properties

API Description
LabeledBy iOS: custom implementation, Android: labelFor

Implementation Details

As with AutomationProperties.LabeledBy, the API and behavior will be very much the same.

The AutomationProperties.LabeledBy attached property allows another element to define accessibility information for the current element. For example, a Label next to an Entry can be used to describe what the Entry represents. This can be accomplished in XAML as follows:

<Label x:Name="label" Text="Enter your name: " />
<Entry AutomationProperties.IsInAccessibleTree="true"
       AutomationProperties.LabeledBy="{x:Reference label}" />

Alternatively, it can be set in C# as follows:

var nameLabel = new Label { Text = "Enter your name: " };
var entry = new Entry();
AutomationProperties.SetIsInAccessibleTree(entry, true);
AutomationProperties.SetLabeledBy(entry, nameLabel);

On Android, it will get mapped down to the android:labelFor attribute, also as before.

On iOS, there is unfortunately no platform equivalent (hence why this property was not previously implemented on XF). However, we will pull some magic strings to make sure .NET MAUI supports this on iOS as well.

Related: #469

@rachelkang rachelkang changed the title [Enhancement] Implement LabeledBy property for accessibility [Spec] Implement LabeledBy property for accessibility May 3, 2021
@rachelkang rachelkang added the legacy-area-a11y Relates to accessibility label May 26, 2021
@rachelkang
Copy link
Member Author

rachelkang commented Nov 5, 2021

Closing as there are no current plans to implement this property. LabeledBy is only built into Android and WinUI, and the difference in behavior it provides, when compared against other screen reader APIs (i.e. contentDescription) was found to be negligible. If needed in the future, handlers may be leveraged.

@ghost ghost locked as resolved and limited conversation to collaborators Feb 19, 2022
@Eilon Eilon added the t/a11y Relates to accessibility label May 13, 2024
@samhouts samhouts added the area-controls-label Label, Span label Aug 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-label Label, Span legacy-area-a11y Relates to accessibility proposal/open t/a11y Relates to accessibility t/enhancement ☀️ New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants