Skip to content

Set UIA Name and HelpText properties on TextInput to match placeholder prop value #12186

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

Merged
merged 6 commits into from
Sep 27, 2023

Conversation

YajurG
Copy link
Contributor

@YajurG YajurG commented Sep 27, 2023

Description

Set the UIA Name property on a TextInput component to match the value of the placeholder property on the TextInput.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Why

Following the guidelines in the Edit control type documentation, which is the control type for TextInput, the Name property should be set by a static text label, or by the application developer (which is when accessibilityLabel is set). In the event that there is no accessibilityLabel property set, the name value defaults to the placeholder text. If there is no accessibilityLabel or placeholder property set, then the UIA Name property will be left unpopulated.

The documentation also says that when a placeholder prop is set, the HelpText UIA property should be set to the value of the placeholder. In the event that the accessibilityHint property is not set, the HelpText property will be set to the placeholder value. If there is no accessibilityLabel or placeholder property set, then the UIA HelpText property will be left unpopulated.

What

Added code to set UIA Name and HelpText properties to placeholder value of TextInput

Screenshots

Before:
image
After:
image

Testing

Tested changes locally on the TextInput example page in RNTester on playground-composition.

Changelog

Yes

Set UIA Name and HelpText properties on TextInput to match placeholder prop value

Microsoft Reviewers: Open in CodeFlow

@YajurG YajurG marked this pull request as ready for review September 27, 2023 20:04
@YajurG YajurG requested a review from a team as a code owner September 27, 2023 20:04
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "uncommented changes",
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the comment should describe what the PR is accomplishing.

Copy link
Contributor

@chiaramooney chiaramooney left a comment

Choose a reason for hiding this comment

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

Looks good to me just make sure to validate that the functionality works with fast refresh.

@YajurG
Copy link
Contributor Author

YajurG commented Sep 27, 2023

I also looked at the WinUI 3 Gallery TextBox component to see their mappings for the UIA Name and HelpText properties. The example on TextBox page does not set the HelpText property even when there is a placeholder value set on the TextBox:

image

@YajurG YajurG changed the title Set UIA Name property on TextInput to match placeholder prop value Set UIA Name and HelpText properties on TextInput to match placeholder prop value Sep 27, 2023
@YajurG YajurG merged commit 941ecd8 into microsoft:main Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants