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

[iOS Accessibility] Bugfix: VoiceOver always seeing fields for all entry types #1213

Closed
wants to merge 4 commits into from

Conversation

eliykat
Copy link
Member

@eliykat eliykat commented Jan 11, 2021

Objective

Bugfix for #1197:

No matter what type of entry you're creating or viewing, VoiceOver is seeing the text fields for every other type of entry (IE, if creating a secure note you see text fields for username, password, credit card number and so on)

The cause of the bug was that VoiceOver (the iOS screenreader) reads invisible elements (i.e. those with IsVisible="False"). However, IsVisible is the primary means for showing/hiding relevant/irrelevant fields and controls.

Code Changes

Whether an element is “visible” to VoiceOver is determined by a separate property, AutomationProperties.IsInAccessibleTree. However, unlike IsVisible, this does not affect child items, so it cannot effectively be applied to a parent StackLayout to hide its children from VoiceOver.

I have therefore generally taken the following approach:

  • Where IsVisible is set on an individual element, set IsInAccessibleTree on that element with the same value.
  • Where IsVisible is set on a layout element, add IsInAccessibleTree to each child with the same value as the parent.
  • However, I didn't do this for the main controls for each item type, because of the large number of elements. Instead, they are added/removed from the element tree as required using code behind.

Issues

The Add URI button is still being picked up by VoiceOver on the AddEdit page, even when it's invisible and IsInAccessibleTree is set to False. I figure I'd looked at this long enough, maybe someone else can spot what's going on.

Other than that, I have tested this on my iPhone 6 and it all works as expected.

@eliykat eliykat changed the title [iOS Accessibility] VoiceOver always seeing fields for all entry types [iOS Accessibility] Bugfix: VoiceOver always seeing fields for all entry types Jan 11, 2021
@eliykat eliykat requested review from cscharf and mpbw2 January 11, 2021 05:49
@eliykat eliykat linked an issue Jan 11, 2021 that may be closed by this pull request
@eliykat eliykat requested review from a team and removed request for cscharf and mpbw2 January 11, 2021 20:11
Copy link

@cscharf cscharf left a comment

Choose a reason for hiding this comment

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

Perhaps a custom render, or renderers would be appropriate or if there is another Xamarin.Forms extension that can be hooked into for this in a more generic way to handle screen reader updates across the board, especially for container/layout visibility changes.
@mportune-bw , any thoughts/ideas on this one?

@cscharf cscharf requested a review from mpbw2 January 11, 2021 20:41
@eliykat
Copy link
Member Author

eliykat commented Jan 12, 2021

After some investigation, I think this could be done much cleaner with a custom renderer to set the native iOS property accessibilityElementsHidden on StackLayout and Grid elements. This property appears to remove an element's children from the accessibility tree, but is not set by the Xamarin.Forms default renderer.

However, in the course of testing a solution to this, I upgraded the Xamarin.Forms package from 4.5.0.725 to 5.0.0.1874 (latest release), and this seems to have fixed the bug entirely.

To make sure, I cloned a fresh copy of the mobile repo, fetched nuget packages, upgraded Xamarin.Forms, and with no other changes the bug disappeared on my iPhone 6 (iOS 12.5).

Can someone else verify this - perhaps on a newer model iPhone?

@cscharf

@mpbw2
Copy link
Contributor

mpbw2 commented Jan 12, 2021

Bumps to Forms require a fair amount of regression testing before we can ship. I'm using 5.x in a work branch and it touches a lot coming from 4.5.x. If also fixes this bug entirely we should probably hold off on this PR.

@cscharf
Copy link

cscharf commented Jan 12, 2021

Bumps to Forms require a fair amount of regression testing before we can ship. I'm using 5.x in a work branch and it touches a lot coming from 4.5.x. If also fixes this bug entirely we should probably hold off on this PR.

Agreed... @eliykat , let's hold off on this one since it appears the update Matt is already working on will resolve this issue. Good find on that!

@eliykat
Copy link
Member Author

eliykat commented Jun 1, 2021

Closing this, as the changes in this PR are unlikely to be relevant once the Xamarin Forms upgrade is complete.

@eliykat eliykat closed this Jun 1, 2021
@cscharf cscharf deleted the voiceover-reads-hidden-controls branch January 19, 2022 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hold do not merge yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS Accessibility] VoiceOver always seeing fields for all entry types
3 participants