diff options
author | Samantha Houts <samantha@teamredwall.com> | 2017-01-31 11:49:15 -0800 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-03-24 13:16:43 +0900 |
commit | 330f236a9e0c87b7e7ea2047e077b16df2e9b4d3 (patch) | |
tree | 4d33bfe5f705cdeb9b3c91f039805b976c35027f /Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs | |
parent | b362c49113b331280cc4f8c7e70fef3e52e07e37 (diff) | |
download | xamarin-forms-330f236a9e0c87b7e7ea2047e077b16df2e9b4d3.tar.gz xamarin-forms-330f236a9e0c87b7e7ea2047e077b16df2e9b4d3.tar.bz2 xamarin-forms-330f236a9e0c87b7e7ea2047e077b16df2e9b4d3.zip |
[All] Basic Accessibility Support (#713)
* [Core] Add accessibility properties
* [Controls] Add accessibility gallery
* [iOS] Implement accessibility properties
* [Android] Implement accessibilty properties
* [Win] Implement accessibility properties
* [Win] Select ListView item on selected for a11y
* Update docs
* TODO: macOS accessibility
* [iOS] Fix failing UI Tests
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs index 68d4702d..3e99cd5d 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs @@ -86,6 +86,21 @@ namespace Xamarin.Forms.Platform.iOS UpdateImage(); } + protected override void SetAccessibilityLabel() + { + // If we have not specified an AccessibilityLabel and the AccessibiltyLabel is current bound to the Title, + // exit this method so we don't set the AccessibilityLabel value and break the binding. + // This may pose a problem for users who want to explicitly set the AccessibilityLabel to null, but this + // will prevent us from inadvertently breaking UI Tests that are using Query.Marked to get the dynamic Title + // of the Button. + + var elemValue = (string)Element?.GetValue(Accessibility.NameProperty); + if (string.IsNullOrWhiteSpace(elemValue) && Control?.AccessibilityLabel == Control?.Title(UIControlState.Normal)) + return; + + base.SetAccessibilityLabel(); + } + void OnButtonTouchUpInside(object sender, EventArgs eventArgs) { ((IButtonController)Element)?.SendClicked(); |