Add missing accessibility identifiers to all interactive UI elements
Audit found ~50+ interactive elements (buttons, toggles, pickers, alerts, links) missing accessibility identifiers across 13 view files. Added centralized ID definitions and applied them to every entry detail button, guided reflection control, settings toggle, paywall unlock button, subscription/IAP button, lock screen control, and photo action dialog.
This commit is contained in:
@@ -814,6 +814,7 @@ struct SettingsContentView: View {
|
||||
}
|
||||
))
|
||||
.labelsHidden()
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.privacyLockToggle)
|
||||
.accessibilityLabel(String(localized: "Privacy Lock"))
|
||||
.accessibilityHint(String(localized: "Require biometric authentication to open app"))
|
||||
}
|
||||
@@ -913,6 +914,7 @@ struct SettingsContentView: View {
|
||||
))
|
||||
.labelsHidden()
|
||||
.disabled(iapManager.shouldShowPaywall)
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.healthSyncToggle)
|
||||
.accessibilityLabel(String(localized: "Apple Health"))
|
||||
.accessibilityHint(String(localized: "Sync mood data with Apple Health"))
|
||||
} else {
|
||||
@@ -1012,6 +1014,7 @@ struct SettingsContentView: View {
|
||||
))
|
||||
.labelsHidden()
|
||||
.disabled(iapManager.shouldShowPaywall)
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.weatherToggle)
|
||||
.accessibilityLabel(String(localized: "Weather"))
|
||||
.accessibilityHint(String(localized: "Show weather details for each day"))
|
||||
}
|
||||
@@ -1128,6 +1131,7 @@ struct SettingsContentView: View {
|
||||
.onChange(of: hapticFeedbackEnabled) { _, newValue in
|
||||
AnalyticsManager.shared.track(.hapticFeedbackToggled(enabled: newValue))
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.hapticFeedbackToggle)
|
||||
.accessibilityLabel(String(localized: "Haptic Feedback"))
|
||||
.accessibilityHint(String(localized: "Toggle vibration feedback when voting"))
|
||||
}
|
||||
@@ -1145,6 +1149,7 @@ struct SettingsContentView: View {
|
||||
AnalyticsManager.shared.track(.deleteToggleChanged(enabled: newValue))
|
||||
}
|
||||
.foregroundColor(textColor)
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.deleteToggle)
|
||||
.accessibilityHint(String(localized: "Allow deleting mood entries by swiping"))
|
||||
.padding()
|
||||
}
|
||||
@@ -1274,6 +1279,7 @@ struct ReminderTimePickerView: View {
|
||||
)
|
||||
.datePickerStyle(.wheel)
|
||||
.labelsHidden()
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.reminderTimePicker)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
@@ -1285,12 +1291,14 @@ struct ReminderTimePickerView: View {
|
||||
Button("Cancel") {
|
||||
dismiss()
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.reminderCancelButton)
|
||||
}
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
Button("Save") {
|
||||
saveReminderTime()
|
||||
dismiss()
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.reminderSaveButton)
|
||||
.fontWeight(.semibold)
|
||||
}
|
||||
}
|
||||
@@ -1545,6 +1553,7 @@ struct SettingsView: View {
|
||||
}
|
||||
))
|
||||
.labelsHidden()
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.privacyLockToggle)
|
||||
}
|
||||
.padding()
|
||||
.background(theme.currentTheme.secondaryBGColor)
|
||||
@@ -1614,6 +1623,7 @@ struct SettingsView: View {
|
||||
))
|
||||
.labelsHidden()
|
||||
.disabled(iapManager.shouldShowPaywall)
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.healthSyncToggle)
|
||||
} else {
|
||||
Text("Not Available")
|
||||
.font(.caption)
|
||||
@@ -1705,6 +1715,7 @@ struct SettingsView: View {
|
||||
))
|
||||
.labelsHidden()
|
||||
.disabled(iapManager.shouldShowPaywall)
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.weatherToggle)
|
||||
}
|
||||
.padding()
|
||||
|
||||
@@ -1963,13 +1974,14 @@ struct SettingsView: View {
|
||||
Text(String(localized: "settings_view_show_onboarding"))
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.showOnboardingButton)
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(theme.currentTheme.secondaryBGColor)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
}
|
||||
|
||||
|
||||
private var eulaButton: some View {
|
||||
Button(action: {
|
||||
AnalyticsManager.shared.track(.eulaViewed)
|
||||
@@ -1978,13 +1990,14 @@ struct SettingsView: View {
|
||||
Text(String(localized: "settings_view_show_eula"))
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.eulaButton)
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(theme.currentTheme.secondaryBGColor)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
}
|
||||
|
||||
|
||||
private var privacyButton: some View {
|
||||
Button(action: {
|
||||
AnalyticsManager.shared.track(.privacyPolicyViewed)
|
||||
@@ -1993,6 +2006,7 @@ struct SettingsView: View {
|
||||
Text(String(localized: "settings_view_show_privacy"))
|
||||
.foregroundColor(textColor)
|
||||
})
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.privacyPolicyButton)
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(theme.currentTheme.secondaryBGColor)
|
||||
@@ -2062,6 +2076,7 @@ struct SettingsView: View {
|
||||
.onChange(of: hapticFeedbackEnabled) { _, newValue in
|
||||
AnalyticsManager.shared.track(.hapticFeedbackToggled(enabled: newValue))
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.hapticFeedbackToggle)
|
||||
.accessibilityLabel(String(localized: "Haptic Feedback"))
|
||||
.accessibilityHint(String(localized: "Toggle vibration feedback when voting"))
|
||||
}
|
||||
@@ -2079,6 +2094,7 @@ struct SettingsView: View {
|
||||
AnalyticsManager.shared.track(.deleteToggleChanged(enabled: newValue))
|
||||
}
|
||||
.foregroundColor(textColor)
|
||||
.accessibilityIdentifier(AccessibilityID.Settings.deleteToggle)
|
||||
.padding()
|
||||
}
|
||||
.background(theme.currentTheme.secondaryBGColor)
|
||||
|
||||
Reference in New Issue
Block a user