MaterialTextField
MaterialTextField copied to clipboard
Implement UIAccessibilityContainer informal protocol and make error labels accessible
Here's a quick summary of the changes
-
MFTextField
is now an accessibility container. - The first accessible element is the underlying text field itself. (It's documented in the
UIAccessibilityContainer
informal protocol that an accessibility container can't itself be accessible, so how is this achieved? I've created a proxy element that decoratesMFTextField
and just delegates all accessibility properties to it.) - The second accessibility element is the error label. It's dynamically added and removed whenever the error label itself appears on screen. In addition, when the error label appears, I'm posting a
UIAccessibilityLayoutChangedNotification
, with the error label as the argument, so the error label gains focus whenever it appears.
Let me know if you have any questions! Seems to work ok using the demo app on my device.
Found the following issues with voice over:
- Cannot swipe up/down to move insertion point when editing text field
- Cannot tap clear text button (black rectangle does not include the clear button like it does for UITextField)