VoiceOver reads attributed strings in multiple segments on iOS 15
NickEntin opened this issue · comments
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.
We have also reproduced this in iOS 15.0.
And this does not reproduce on iOS 14, so confirmed this is a behavior change in iOS 15.
Did a more thorough test on iOS 15.3.1 and found the following.
These attributes trigger this behavior:
.backgroundColor
.ligature
.kern
.tracking
.strikethroughStyle
.underlineStyle
.strokeColor
.strokeWidth
.attachment
.link
.underlineColor
.strikethroughColor
.obliqueness
.expansion
.writingDirection
.verticalGlyphForm
These attributes do not trigger the behavior:
.foregroundColor
.font
.paragraphStyle
.shadow
.textEffect
.baselineOffset
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.