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

fix(android): a11y - do not provide content description for TextView elements #9673

Merged
merged 7 commits into from Jan 23, 2022

Conversation

felixkrautschuk
Copy link
Contributor

@felixkrautschuk felixkrautschuk commented Nov 18, 2021

fix(android-accessibility): do not provide content description for TextView elements

Android accessibility services automatically announce the text itself as the description (see https://developer.android.com/guide/topics/ui/accessibility/apps#describe-ui-element)

fixes #9588

PR Checklist

What is the current behavior?

Right now, content descriptions are also applied to Labels (Android TextViews) which breaks accessibility when using Labels/FormattedStrings with databinding or inside RadListViews.
The Android docs say:

Note: Don't provide descriptions for TextView elements. Android accessibility services automatically announce the text itself as the description.

What is the new behavior?

The assignment of a content description is skipped for TextView elements, now screenreaders (e.g. Google Talkback) are reading the text of a Label correctly in all situations (simple Label, FormattedString, databinding with some delay, inside RadListViews, etc...).

Fixes #9588 .

…xtView elements

Android accessibility services automatically announce the text itself as the description (see https://developer.android.com/guide/topics/ui/accessibility/apps#describe-ui-element)

fixes NativeScript#9588
@cla-bot cla-bot bot added the cla: yes label Nov 18, 2021
@felixkrautschuk
Copy link
Contributor Author

@felixkrautschuk felixkrautschuk commented Nov 18, 2021

One test is failing: test_automation_text_set_to_native

For some reason, my change causes a new issue:
<Button accessibilityLabel="This is my button"/>
Google Talkback just reads: "Button" instead of the accessibilityLabel.

My check for instanceof android.widget.TextView does not work here, since android.widget.Button is extending android.widget.TextView

If an accessibility-property is provided, the content description should also be set for TextView elements to keep the support for Labels/Buttons that only have a font icon as text and therefore need to have an accessibilityLabel.
@felixkrautschuk
Copy link
Contributor Author

@felixkrautschuk felixkrautschuk commented Nov 19, 2021

Now all tests are succeeding, at least when running them on my local machine.

@NathanWalker NathanWalker changed the base branch from master to release/8.2.0 Jan 23, 2022
@NathanWalker NathanWalker changed the title fix(android-accessibility): do not provide content description for TextView elements fix(android): a11y - do not provide content description for TextView elements Jan 23, 2022
@NathanWalker NathanWalker merged commit 2890381 into NativeScript:release/8.2.0 Jan 23, 2022
2 of 3 checks passed
NathanWalker pushed a commit that referenced this issue Feb 14, 2022
…elements (#9673)

Android accessibility services automatically announce the text itself as the description (see https://developer.android.com/guide/topics/ui/accessibility/apps#describe-ui-element)

If an a11y property is provided, the content description should also be set for TextView elements to keep the support for Labels/Buttons that only have a font icon as text and therefore need to have an accessibilityLabel.

Co-authored-by: Nathan Walker <walkerrunpdx@gmail.com>

closes #9588
NathanWalker pushed a commit that referenced this issue Feb 15, 2022
…elements (#9673)

Android accessibility services automatically announce the text itself as the description (see https://developer.android.com/guide/topics/ui/accessibility/apps#describe-ui-element)

If an a11y property is provided, the content description should also be set for TextView elements to keep the support for Labels/Buttons that only have a font icon as text and therefore need to have an accessibilityLabel.

Co-authored-by: Nathan Walker <walkerrunpdx@gmail.com>

closes #9588
NathanWalker pushed a commit that referenced this issue Feb 15, 2022
…elements (#9673)

Android accessibility services automatically announce the text itself as the description (see https://developer.android.com/guide/topics/ui/accessibility/apps#describe-ui-element)

If an a11y property is provided, the content description should also be set for TextView elements to keep the support for Labels/Buttons that only have a font icon as text and therefore need to have an accessibilityLabel.

Co-authored-by: Nathan Walker <walkerrunpdx@gmail.com>

closes #9588
NathanWalker pushed a commit that referenced this issue Feb 18, 2022
…elements (#9673)

Android accessibility services automatically announce the text itself as the description (see https://developer.android.com/guide/topics/ui/accessibility/apps#describe-ui-element)

If an a11y property is provided, the content description should also be set for TextView elements to keep the support for Labels/Buttons that only have a font icon as text and therefore need to have an accessibilityLabel.

Co-authored-by: Nathan Walker <walkerrunpdx@gmail.com>

closes #9588
NathanWalker pushed a commit that referenced this issue Mar 1, 2022
…elements (#9673)

Android accessibility services automatically announce the text itself as the description (see https://developer.android.com/guide/topics/ui/accessibility/apps#describe-ui-element)

If an a11y property is provided, the content description should also be set for TextView elements to keep the support for Labels/Buttons that only have a font icon as text and therefore need to have an accessibilityLabel.

Co-authored-by: Nathan Walker <walkerrunpdx@gmail.com>

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

Successfully merging this pull request may close these issues.

2 participants