Skip to content

Commit

Permalink
Merge pull request #668 from kiwicom/fix-inputcontent-label-accessibi…
Browse files Browse the repository at this point in the history
…lity

Update accessibility of InputContent labels
  • Loading branch information
PavelHolec authored Aug 23, 2023
2 parents c1ed261 + 6833f7d commit 72cddad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 0 additions & 7 deletions Sources/Orbit/Support/Forms/FieldLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public struct FieldLabel: View {
public var body: some View {
Text(label)
.fontWeight(.medium)
.accessibility(.fieldLabel)
}

/// Create Orbit form field label.
Expand All @@ -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 {

Expand Down
3 changes: 2 additions & 1 deletion Sources/Orbit/Support/Forms/FieldWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ public struct FieldWrapper<Label: View, Content: View, Footer: View>: 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
Expand Down
3 changes: 3 additions & 0 deletions Sources/Orbit/Support/Forms/InputContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public struct InputContent<Content: View, Prefix: View, Suffix: View>: View {
.padding(.leading, .small)
.padding(.trailing, -.xxSmall)
.textColor(labelColor)
// Component should expose label as part of content
.accessibility(hidden: true)
.accessibility(removeTraits: .isStaticText)

content
}
Expand Down

0 comments on commit 72cddad

Please sign in to comment.