-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace newlines in a11y labels with spaces #502
Conversation
return label | ||
|
||
// We need to replace all newlines with \n | ||
return label.components(separatedBy: .newlines).filter { !$0.isEmpty }.joined(separator: " ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit tests please!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be explicit, theres no prohibition against new lines in accessibility labels. This is a style choice we've made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tests were a good idea! you'll never believe this: they caught a bug (the change up above that i missed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move the line into a private category on string in this file now that we have two copies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
Thanks for fixing the regression. |
The built in accessibility labels do some mangling of newlines to remove them. Our implementation in `0e9041b4714cac99baa69f4b1b484503868311ba` caused regressions in snapshot and KIF testing.
0b25f8d
to
c801e91
Compare
!links.isEmpty | ||
else { | ||
// We need to replace all newlines with " " | ||
return string.components(separatedBy: .newlines).filter { !$0.isEmpty }.joined(separator: " ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes me question where this was happening before...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably the default value coming from UIKit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, that's what i think too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, i tested it and it seems to be happening inside UILabel and only occurs when you don't provide an explicit label.
* tag '4.3.0': Prepare version 4.3.0 (#513) Add passThroughTouches to BlueprintView, PassthroughView (#511) Bump checkout and upload-artifacts (#512) Bump rexml from 3.2.8 to 3.3.6 Unnest Box.CornerStyle (#508) Prepare 4.2.1 (#507) Make public the UIBezierPath helper using Box.CornerStyle Prepare 4.2.0 (#505) Label and AttributedLabel now support accessibilityValue (#504) Prepare 4.1.2 Release (#503) Replace newlines in a11y labels with spaces (#502) Fix string index out of bounds crash. (#501) bumping version to 4.1.0 (#499) AttributedLabel Link Accessibility (#459)
The built in accessibility labels do some mangling of newlines to remove them. Our implementation in
0e9041b4714cac99baa69f4b1b484503868311ba
caused regressions in snapshot and KIF testing.