Fix mood buttons hidden from accessibility tree in all voting layouts
The parent container's .accessibilityElement(children: .contain) and .accessibilityLabel were collapsing individual mood buttons into a single group, making them invisible to accessibility tools like AXe and VoiceOver. Fix: Add .accessibilityElement(children: .ignore) and .accessibilityAddTraits (.isButton) to each individual mood button, and remove the group-level accessibility modifiers. Applied to all 6 voting layouts (Horizontal, Card, Stacked, Aura, Orbit, Neon).
This commit is contained in:
@@ -69,7 +69,6 @@ struct AddMoodHeaderView: View {
|
||||
.background(theme.currentTheme.secondaryBGColor)
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.accessibilityIdentifier(AccessibilityID.DayView.moodHeader)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
@@ -125,13 +124,13 @@ struct HorizontalVotingView: View {
|
||||
}
|
||||
.buttonStyle(MoodButtonStyle())
|
||||
.frame(maxWidth: .infinity)
|
||||
.accessibilityElement(children: .ignore)
|
||||
.accessibilityAddTraits(.isButton)
|
||||
.accessibilityIdentifier(AccessibilityID.MoodButton.id(for: mood.widgetDisplayName))
|
||||
.accessibilityLabel(mood.strValue)
|
||||
.accessibilityHint(String(localized: "Select this mood"))
|
||||
}
|
||||
}
|
||||
.accessibilityElement(children: .contain)
|
||||
.accessibilityLabel(String(localized: "Mood selection"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,8 +166,6 @@ struct CardVotingView: View {
|
||||
}
|
||||
}
|
||||
.frame(height: 190)
|
||||
.accessibilityElement(children: .contain)
|
||||
.accessibilityLabel(String(localized: "Mood selection"))
|
||||
}
|
||||
|
||||
private func cardButton(for mood: Mood, width: CGFloat) -> some View {
|
||||
@@ -190,6 +187,8 @@ struct CardVotingView: View {
|
||||
)
|
||||
}
|
||||
.buttonStyle(CardButtonStyle())
|
||||
.accessibilityElement(children: .ignore)
|
||||
.accessibilityAddTraits(.isButton)
|
||||
.accessibilityIdentifier(AccessibilityID.MoodButton.id(for: mood.widgetDisplayName))
|
||||
.accessibilityLabel(mood.strValue)
|
||||
.accessibilityHint(String(localized: "Select this mood"))
|
||||
@@ -230,13 +229,13 @@ struct StackedVotingView: View {
|
||||
)
|
||||
}
|
||||
.buttonStyle(CardButtonStyle())
|
||||
.accessibilityElement(children: .ignore)
|
||||
.accessibilityAddTraits(.isButton)
|
||||
.accessibilityIdentifier(AccessibilityID.MoodButton.id(for: mood.widgetDisplayName))
|
||||
.accessibilityLabel(mood.strValue)
|
||||
.accessibilityHint(String(localized: "Select this mood"))
|
||||
}
|
||||
}
|
||||
.accessibilityElement(children: .contain)
|
||||
.accessibilityLabel(String(localized: "Mood selection"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,6 +316,8 @@ struct AuraVotingView: View {
|
||||
}
|
||||
}
|
||||
.buttonStyle(AuraButtonStyle(color: color))
|
||||
.accessibilityElement(children: .ignore)
|
||||
.accessibilityAddTraits(.isButton)
|
||||
.accessibilityIdentifier(AccessibilityID.MoodButton.id(for: mood.widgetDisplayName))
|
||||
.accessibilityLabel(mood.strValue)
|
||||
.accessibilityHint(String(localized: "Select this mood"))
|
||||
@@ -355,8 +356,6 @@ struct OrbitVotingView: View {
|
||||
.onDisappear {
|
||||
centerPulse = 1.0
|
||||
}
|
||||
.accessibilityElement(children: .contain)
|
||||
.accessibilityLabel(String(localized: "Mood selection"))
|
||||
}
|
||||
|
||||
private func orbitalRing(radius: CGFloat, centerX: CGFloat, centerY: CGFloat) -> some View {
|
||||
@@ -408,6 +407,8 @@ struct OrbitVotingView: View {
|
||||
}
|
||||
.buttonStyle(OrbitButtonStyle(color: color))
|
||||
.position(x: posX, y: posY)
|
||||
.accessibilityElement(children: .ignore)
|
||||
.accessibilityAddTraits(.isButton)
|
||||
.accessibilityIdentifier(AccessibilityID.MoodButton.id(for: mood.widgetDisplayName))
|
||||
.accessibilityLabel(mood.strValue)
|
||||
.accessibilityHint(String(localized: "Select this mood"))
|
||||
@@ -696,6 +697,8 @@ struct NeonEqualizerBar: View {
|
||||
}
|
||||
.buttonStyle(NeonBarButtonStyle(isPressed: $isPressed))
|
||||
.frame(maxWidth: .infinity)
|
||||
.accessibilityElement(children: .ignore)
|
||||
.accessibilityAddTraits(.isButton)
|
||||
.accessibilityIdentifier(AccessibilityID.NeonMoodButton.id(for: mood.widgetDisplayName))
|
||||
.accessibilityLabel(mood.strValue)
|
||||
.accessibilityHint(String(localized: "Select this mood"))
|
||||
|
||||
Reference in New Issue
Block a user