question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[TextInputEditText] [TextInputLayout] Add property to indicate field is required

See original GitHub issue

Is your feature request related to a problem? Please describe. The screenreader (TalkBack) does not tell users that a field is required. There is no way to indicate that information only to the screen reader without changing the UI (hint text).

Describe the solution you’d like A way to indicate to screen readers (such as TalkBack) via XML that an input field is required. A new XML field app:isRequired=[boolean] that would default to false.

Describe alternatives you’ve considered We have tried using onInitializeAccessibilityNodeInfo from View.AccessibilityDelegate and it worked for adding additional info to the screen reader without changing the UI, but it also stopped announcing errors - a bigger problem than what we’re solving for

Additional context We could add the word “Required” to the hint text on the TextInputLayout and it’ll be read by the screen reader, but we are trying to do this without changing our UI.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
vick08commented, Mar 23, 2020

Just to clarify… There is currently no attribute in Android Accessibility framework that would allow expressing the “required” state semantically. Presently, the only way to communicate to a screen reader user that the field is required is through UI treatment, e.g. marking up with a “*” sign or the word “required” (if feasible). The above suggestion that a “disabled” “next” button is a good signal is not entirely accurate because it does not tell the user which of the fields is a culprit.

0reactions
drchencommented, Jul 16, 2021

I think there’s a very low chance for us to add this support. The reason is as stated above by @ldjcmu. Please consider other workarounds like using hint or helper text.

Will close the issue for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make TextInputLayout hint asterisk red for required fields
Material Design specify an asterisk for the required fields that is part of the hint text, and of the same color (not in...
Read more >
TextInputLayout | Android Developers
Layout which wraps a TextInputEditText , EditText , or descendant to show a floating label when the hint is hidden while the user...
Read more >
Android TextInputLayout Example | DigitalOcean
Setting app:errorEnabled to true allows us to display an error text on condition beneath our EditText field. To style the Error Text, we'd...
Read more >
Material Design Edit Text | Android Studio Tutorial - YouTube
TextInputEditText - Material Design Edit Text | Android Studio Tutorial ... allows us to customize this input field to fit all our needs....
Read more >
Text fields - Material Design
Note : A text field is composed of a TextInputLayout and a TextInputEditText as a direct child. Using an EditText as the child...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found