Accessibility in SfTextInputLayout
28 Dec 20211 minute to read
The text input layout control has built-in AutomationId for inner elements. To keep unique id for inner elements, AutomationId of inner elements are updated based on SfTextInputLayout’s AutomationId. For example, if SfTextInputLayout’s AutomationId is set as sfTextInputLayout.AutomationId = “textInputLayout”, then AutomationId of inner elements will be updated as follows.
Element | Element AutomationId | Qualified AutomationId |
---|---|---|
Password Toggle VisibleIcon | show password | textInputLayout show password |
Password Toggle CollapsedIcon | hide password | textInputLayout hide password |
DropDown Button | drop down | textInputLayout drop down |
The following code snippet demonstrates how to set the AutomationId
to SfTextInputLayout.
<inputLayout:SfTextInputLayout
Hint="Name"
EnablePasswordVisibilityToggle="true"
AutomationId="textInputLayout">
<Entry Text="John" />
</inputLayout:SfTextInputLayout>
SfTextInputLayout inputLayout = new SfTextInputLayout();
inputLayout.Hint = "Name";
inputLayout.EnablePasswordVisibilityToggle = true;
inputLayout.InputView = new Entry() { Text = "John" };
inputLayout.AutomationId = "textInputLayout";
Refer to the following code snippet to access the inner elements of SfTextInputLayout from the automation script.
[Test]
[Description("SfTextInputLayout Automation Id")]
public void SfTextInputLayout_AutomationId()
{
// To tap the Password Toggle VisibleIcon
App.Tap("textInputLayout show password");
// To tap the Password Toggle CollapsedIcon
App.Tap("textInputLayout hide password");
}