cbpowell / MarqueeLabel

A drop-in replacement for UILabel, which automatically adds a scrolling marquee effect when the label's text does not fit inside the specified frame
MIT License
4.21k stars 564 forks source link

MarqueeLabel's isAccessibilityElement being set causes sublabel isAcc… #204

Closed alexbell closed 6 years ago

alexbell commented 6 years ago

…essibilityElement to be set to same

useful when using MarqueeLabel to display content that is not text.

thanks for your work on this!

cbpowell commented 6 years ago

Thanks for this!

I did a little bit of looking into accessibility elements just now, but it seems like you probably have more experience - so I'd like to run this by you. The way you've set it up here is such that when isAccessibilityElement is set to true on a MarqueeLabel instance, the value of that property for both the ML instance itself and the underlying UILabel instance both are set to true.

To avoid a nested element situation, would it be better to just pass the setting to the underlying UILabel?

cbpowell commented 6 years ago

Checking in on this one again - @alexbell did you have any thoughts on my comments above?

alexbell commented 6 years ago

@cbpowell sorry for the latency! i tried setting the flag on only the underlying label, in my test Voiceover still shows it as a tappable accessibility element due to this though. i think the flag needs to be set on both to get the effect of Voiceover ignoring the Marquee label completely.

cbpowell commented 6 years ago

I totally missed that you were interesting it making non-accessible, which is what was confusing me with this change because the UILabel subview is accessible by default (without any modification to MarqueeLabel). But I played around with it a bit and the change looks good, I'll incorporate!

alexbell commented 6 years ago

@cbpowell thanks, ya it's kind of a non standard use of a label. we're using MarqueeLabel to animate glyphs which make up the background of our onboarding screen.