[TextInputEditText] [TextInputLayout] Add property to indicate field is required
See original GitHub issueIs 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:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
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.
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.