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

Accessibility Name or HelpText properties added to Switch are visible in Android UI #3208

roberleitner opened this issue Jul 3, 2018 · 1 comment · Fixed by #4094


Copy link

commented Jul 3, 2018


Accessibility values add to a Xamarin Forms Switch control are being rendered as visible text on Android.

Steps to Reproduce

  1. Create a new cross platform Xamarin Forms app
  2. Add a Switch to MainPage.xaml's layout
  3. Set AutomationProperties.IsInAccessibleTree="true" on the Switch
  4. Set AutomationProperties.Name and or AutomationProperties.HelptText values on the Switch
  5. Run in any Android Device or Simulator

Expected Behavior

Accessibility text should not be visible in the UI.

Actual Behavior

Observe the values set for AutomationProperties.Name and or AutomationProperties.HelpText render as a text to the left of the Switch. If both are added, both will appear in concatenated form.

Basic Information

  • Version with issue: 3.0, 3.1, and current latest master branch
  • Last known good version: N/A
  • IDE: Visual Studio 15.7.4 Windows, Visual Studio for Mac 7.5.3 build 7
  • Platform Target Frameworks:
    • iOS: N/A
    • Android: 8.1
    • UWP: N/A
  • Android Support Library Version: v4, v7
  • Nuget Packages:
  • Affected Devices: Google Nexus 5X; Android Emulators 8.1, 7.1.1, 4.4


screen shot 2018-07-03 at 2 05 49 pm

Reproduction Link


Per the documentation here on Accessibility Values, Name and or HelpText should ultimately end up as the ContentDescription of an Android UI control but in this case, Hint on the control is being set to this value rather than ContentDescription which I suppose is why it is rendering in the UI.

I cloned the latest Xamarin Forms project and created my own nuget package to debug the issue. What I am seeing is in AutomationPropertiesProvider, there is a check in the SetHint method that if the control is a TextView, it will set the control's accessibility name and help text as the hint. If this method succeeds, SetContentDescription will never set the control's ContentDescription. Both Android.Widget.Switch and Android.Widget.SwitchCompat derive from TextView so a simple check of the control being a TextView as to whether to set the Hint or ContentDescription is flawed.

@pauldipietro pauldipietro added this to New in Triage Jul 3, 2018


This comment has been minimized.

Copy link

commented Jul 4, 2018

Repro project:

@hartez hartez moved this from New to Ready For Work in Triage Jul 4, 2018

@samhouts samhouts added this to To do in Sprint 143 Oct 15, 2018

@samhouts samhouts removed this from Ready For Work in Triage Oct 15, 2018

@samhouts samhouts added this to In Progress in v3.6.0 Oct 16, 2018

@samhouts samhouts moved this from To do to Ready for Review (Issues) in Sprint 143 Oct 16, 2018

Sprint 143 automation moved this from Ready for Review (Issues) to Done Oct 23, 2018

Android Ready For Work automation moved this from To do to Done Oct 23, 2018

@samhouts samhouts moved this from In Progress to Done in v3.6.0 Oct 23, 2018

@samhouts samhouts removed this from Done in v3.6.0 Jan 3, 2019

@samhouts samhouts added this to In Progress in v3.5.0 Jan 11, 2019

@samhouts samhouts moved this from In Progress to Done in v3.5.0 Jan 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.