From ca354e93a53d68a1d7eefc9c9c9d548b5340c375 Mon Sep 17 00:00:00 2001 From: Kyle Van Essen Date: Wed, 1 May 2024 22:17:18 -0700 Subject: [PATCH] Support overriding a11y label on AttributedLabel --- BlueprintUICommonControls/Sources/AttributedLabel.swift | 5 +++++ CHANGELOG.md | 2 ++ 2 files changed, 7 insertions(+) diff --git a/BlueprintUICommonControls/Sources/AttributedLabel.swift b/BlueprintUICommonControls/Sources/AttributedLabel.swift index 1b124bc90..7e412a4b5 100644 --- a/BlueprintUICommonControls/Sources/AttributedLabel.swift +++ b/BlueprintUICommonControls/Sources/AttributedLabel.swift @@ -77,6 +77,10 @@ public struct AttributedLabel: Element, Hashable { /// A set of accessibility traits that should be applied to the label, these will be merged with any existing traits. public var accessibilityTraits: Set? + /// A localized string that is read when the label is selected by the accessibility system. If this value is not provided, + /// the plain text version of the `attributedText` is used. + public var accessibilityLabel: String? + /// A localized string that describes the result of performing an action on the element, when the result is non-obvious. public var accessibilityHint: String? @@ -252,6 +256,7 @@ extension AttributedLabel { } isAccessibilityElement = model.isAccessibilityElement + accessibilityLabel = model.accessibilityLabel accessibilityHint = model.accessibilityHint updateAccessibilityTraits(with: model) accessibilityCustomActions = model.accessibilityCustomActions.map { action in diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e267fd1b..6bf25f4cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- `AttributedLabel` now supports overriding `accessibilityLabel`. + ### Removed ### Changed