From 32875cdb9b5c1ef1baa57fd0aa61a83af2525685 Mon Sep 17 00:00:00 2001 From: John Newman Date: Wed, 16 Apr 2025 18:06:56 -0400 Subject: [PATCH 1/2] Adding an accessibilityIdentifier to the reorder gesture. --- BlueprintUILists/Sources/ListReorderGesture.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/BlueprintUILists/Sources/ListReorderGesture.swift b/BlueprintUILists/Sources/ListReorderGesture.swift index 6a13c1b63..eb79eaadf 100644 --- a/BlueprintUILists/Sources/ListReorderGesture.swift +++ b/BlueprintUILists/Sources/ListReorderGesture.swift @@ -59,6 +59,9 @@ public struct ListReorderGesture : Element /// The acccessibility label for the reorder element. Defaults to "Reorder". public var accessibilityLabel : String? + /// The acccessibility identifier for the reorder element. + public var accessibilityIdentifier : String? + /// Creates a new re-order gesture which wraps the provided element. /// /// This element on its own has no visual appearance. Thus, you should @@ -68,6 +71,7 @@ public struct ListReorderGesture : Element actions : ReorderingActions, begins: Begins = .onTap, accessibilityLabel: String? = nil, + accessibilityIdentifier: String? = nil, wrapping element : Element ) { self.isEnabled = isEnabled @@ -78,6 +82,8 @@ public struct ListReorderGesture : Element self.accessibilityLabel = accessibilityLabel + self.accessibilityIdentifier = accessibilityIdentifier + self.element = element } @@ -115,12 +121,14 @@ public extension Element with actions : ReorderingActions, isEnabled : Bool = true, begins: ListReorderGesture.Begins = .onTap, - accessibilityLabel: String? = nil + accessibilityLabel: String? = nil, + accessibilityIdentifier: String? = nil ) -> Element { ListReorderGesture(isEnabled: isEnabled, actions: actions, begins: begins, accessibilityLabel: accessibilityLabel, + accessibilityIdentifier: accessibilityIdentifier, wrapping: self) } } @@ -173,6 +181,7 @@ fileprivate extension ListReorderGesture func apply(_ model: ListReorderGesture) { proxyElement.accessibilityLabel = model.accessibilityLabel ?? ListableLocalizedStrings.ReorderGesture.accessibilityLabel proxyElement.accessibilityHint = ListableLocalizedStrings.ReorderGesture.accessibilityHint + proxyElement.accessibilityIdentifier = model.accessibilityIdentifier proxyElement.accessibilityTraits.formUnion(.button) proxyElement.accessibilityCustomActions = model.accessibilityActions() From e67c86ebb7f6f11eafe6d82349cc53a9c470ec14 Mon Sep 17 00:00:00 2001 From: John Newman Date: Wed, 16 Apr 2025 18:23:26 -0400 Subject: [PATCH 2/2] Changelog updates. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8413714cc..c8e50c2c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Added +- Adding an `accessibilityIdentifier` to the `ListReorderGesture` element. + ### Removed ### Changed