Skip to content

Commit b455de6

Browse files
Reverting the change to remove accessibility traits on the AttributedLabel (#597)
This reverts #590. During integration testing, the original change caused KIF failures while searching for labels with the `staticText` trait. The work to audit the failures and make necessary code changes has been ticketed [here](https://block.atlassian.net/browse/UI-9567). This revert allows the changes in #596 to be fully tested.
1 parent 9e1828e commit b455de6

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

BlueprintUICommonControls/Sources/AttributedLabel.swift

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -336,20 +336,18 @@ extension AttributedLabel {
336336
}
337337

338338
private func updateAccessibilityTraits(with model: AttributedLabel) {
339-
guard let traits = model.accessibilityTraits else {
340-
accessibilityTraits = []
341-
return
342-
}
339+
if let traits = model.accessibilityTraits {
343340

344-
var uiTraits = UIAccessibilityTraits(with: traits)
341+
var traits = UIAccessibilityTraits(with: traits)
345342

346-
if uiTraits.contains(.updatesFrequently) {
347-
/// `UILabel` has the `.staticText` trait by default.
348-
/// If we explicitly set `.updatesFrequently` this should be removed.
349-
uiTraits.subtract(.staticText)
350-
}
343+
if traits.contains(.updatesFrequently) {
344+
/// `UILabel` has the `.staticText` trait by default.
345+
/// If we explicitly set `.updatesFrequently` this should be removed.
346+
traits.subtract(.staticText)
347+
}
351348

352-
accessibilityTraits = uiTraits
349+
accessibilityTraits = traits
350+
}
353351
}
354352

355353
override func drawText(in rect: CGRect) {

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Fixed
1111

12+
- Revert applying empty accessibility traits to `AttributedLabel` if supplied traits is `nil`.
13+
1214
### Added
1315

1416
### Removed

0 commit comments

Comments
 (0)