mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge pull request #2678 from m-abs/issue-2621
Fixes #2621: Add accessibility labels to views
This commit is contained in:
@@ -79,4 +79,5 @@ export function test_automation_text_set_to_native() {
|
|||||||
var newButton = new button.Button();
|
var newButton = new button.Button();
|
||||||
newButton.automationText = "Button1";
|
newButton.automationText = "Button1";
|
||||||
TKUnit.assertEqual((<UIView>newButton.ios).accessibilityIdentifier, "Button1", "accessibilityIdentifier not set to native view.");
|
TKUnit.assertEqual((<UIView>newButton.ios).accessibilityIdentifier, "Button1", "accessibilityIdentifier not set to native view.");
|
||||||
}
|
TKUnit.assertEqual((<UIView>newButton.ios).accessibilityLabel, "Button1", "accessibilityIdentifier not set to native view.");
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ global.moduleMerge(viewCommon, exports);
|
|||||||
function onAutomationTextPropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
function onAutomationTextPropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
||||||
var view = <View>data.object;
|
var view = <View>data.object;
|
||||||
view._nativeView.accessibilityIdentifier = data.newValue;
|
view._nativeView.accessibilityIdentifier = data.newValue;
|
||||||
|
view._nativeView.accessibilityLabel = data.newValue;
|
||||||
}
|
}
|
||||||
(<proxy.PropertyMetadata>viewCommon.View.automationTextProperty.metadata).onSetNativeValue = onAutomationTextPropertyChanged;
|
(<proxy.PropertyMetadata>viewCommon.View.automationTextProperty.metadata).onSetNativeValue = onAutomationTextPropertyChanged;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user