cashapp / AccessibilitySnapshot

Easy regression testing for iOS accessibility
Apache License 2.0
541 stars 67 forks source link

VoiceOver reads attributed strings in multiple segments on iOS 15 #84

Open NickEntin opened 2 years ago

NickEntin commented 2 years ago

VoiceOver now appears to read attributed strings in segments based on attribute ranges. You can see this behavior through the following example:

let attributedText = NSMutableAttributedString(string: "Hello world")
attributedText.addAttributes([.kern: 1], range: NSRange(location: 9, length: 1))

let label = UILabel()
label.attributedText = attributedText

VoiceOver will read this as Hello wor, l, d. This reproduces for a variety of attributes such as kerning, foreground color, and background color.

I was able to reproduce this on iOS 15.1.1, but not on iOS 13.3. As far as I know this is a new issue on iOS 15, but it's possible it applies to 14 as well.

NickEntin commented 2 years ago

We have also reproduced this in iOS 15.0.

NickEntin commented 2 years ago

And this does not reproduce on iOS 14, so confirmed this is a behavior change in iOS 15.

NickEntin commented 2 years ago

Did a more thorough test on iOS 15.3.1 and found the following.

These attributes trigger this behavior:

These attributes do not trigger the behavior:

I'm not sure why some attributes do and some don't, and I had tested .foregroundColor before with a different result, so I'm not sure if that changed across minor OS versions.