devxoul / UITextView-Placeholder

A missing placeholder for UITextView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Placeholder label should have isAccessibilityElement set to NO

jlubeck opened this issue · comments

Just like you have the userInteractionEnabled set to NO, the isAccessibilityElement should be NO as well, otherwise it is being selected by VoiceOver

It seems that it is already NO.

The default state for UITextView's isAccessibilityElement is YES. And there is nowhere in the code where it is being set to NO. I also created this ticket at the time because I was running into the issue with actual users and I don't see any changes in the code that addressed this since then.

I'm happy to create a pull request myself if you want, it's just 1 line of code.

@jlubeck, that's weird. How did you know that isAccessibilityElement is YES by default? When I check the value in the Playground and a new project it returns NO.

Screen Shot 2019-08-07 at 6 15 59 PM

Hey, like I mentioned, I had users complain about the issue, so that's how I found out about it initially. And if you put a new UITextView into a storyboard, you can see on the Accessibility section that it is Enabled.

Also, even by creating the UITextView by code, after you turn VoiceOver ON, you will be able to tap on the UITextView, which means it is an accessibilityElement.

I don't know why a Playground would show it as false. Or even worse, I'm checking with a breakpoint, that even though the UITextView is being selectable by VoiceOver, the console is telling me that its isAccessibilityElement is false as well. BUT, if after creating it, I specifically set isAccessibilityElement to false, then it works as expected and VoiceOver doesn't select it.

So that sounds like a weird bug on Apple's side, but in the meantime, just setting textView.isAccessibilityElement = NO; somewhere around line 105 on UITextView+Placeholder.m fixes the issue immediately.