From 6833f7d5c70ded741163603fa844466d3b3d39cd Mon Sep 17 00:00:00 2001 From: Pavel Holec Date: Tue, 22 Aug 2023 19:56:30 +0200 Subject: [PATCH] Update accessibility of InputContent labels --- Sources/Orbit/Support/Forms/FieldLabel.swift | 7 ------- Sources/Orbit/Support/Forms/FieldWrapper.swift | 3 ++- Sources/Orbit/Support/Forms/InputContent.swift | 3 +++ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Sources/Orbit/Support/Forms/FieldLabel.swift b/Sources/Orbit/Support/Forms/FieldLabel.swift index 574df84805d..69b7f16bf9f 100644 --- a/Sources/Orbit/Support/Forms/FieldLabel.swift +++ b/Sources/Orbit/Support/Forms/FieldLabel.swift @@ -8,7 +8,6 @@ public struct FieldLabel: View { public var body: some View { Text(label) .fontWeight(.medium) - .accessibility(.fieldLabel) } /// Create Orbit form field label. @@ -17,12 +16,6 @@ public struct FieldLabel: View { } } -// MARK: - Identifiers -public extension AccessibilityID { - - static let fieldLabel = Self(rawValue: "orbit.field.label") -} - // MARK: - Previews struct FieldLabelPreviews: PreviewProvider { diff --git a/Sources/Orbit/Support/Forms/FieldWrapper.swift b/Sources/Orbit/Support/Forms/FieldWrapper.swift index 9cf65d1f1b0..d21e49d8a94 100644 --- a/Sources/Orbit/Support/Forms/FieldWrapper.swift +++ b/Sources/Orbit/Support/Forms/FieldWrapper.swift @@ -13,8 +13,9 @@ public struct FieldWrapper: View { public var body: some View { VStack(alignment: .leading, spacing: 0) { label - // The component should expose the label as a part of the field primary input or action + // Component should expose label as part of content .accessibility(hidden: true) + .accessibility(removeTraits: .isStaticText) .padding(.bottom, .xxSmall) content diff --git a/Sources/Orbit/Support/Forms/InputContent.swift b/Sources/Orbit/Support/Forms/InputContent.swift index 9f1e9015173..6fad7ed1d11 100644 --- a/Sources/Orbit/Support/Forms/InputContent.swift +++ b/Sources/Orbit/Support/Forms/InputContent.swift @@ -34,6 +34,9 @@ public struct InputContent: View { .padding(.leading, .small) .padding(.trailing, -.xxSmall) .textColor(labelColor) + // Component should expose label as part of content + .accessibility(hidden: true) + .accessibility(removeTraits: .isStaticText) content }