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:
@@ -81,6 +81,7 @@ struct NoteEditorView: View {
|
||||
Button("Done") {
|
||||
isTextFieldFocused = false
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityID.NoteEditor.keyboardDoneButton)
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
@@ -226,7 +227,9 @@ struct EntryDetailView: View {
|
||||
onDelete()
|
||||
dismiss()
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityID.EntryDetail.deleteConfirmButton)
|
||||
Button("Cancel", role: .cancel) { }
|
||||
.accessibilityIdentifier(AccessibilityID.EntryDetail.deleteCancelButton)
|
||||
} message: {
|
||||
Text("Are you sure you want to delete this mood entry? This cannot be undone.")
|
||||
}
|
||||
@@ -461,6 +464,7 @@ struct EntryDetailView: View {
|
||||
.font(.subheadline)
|
||||
.fontWeight(.medium)
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityID.EntryDetail.reflectionBeginButton)
|
||||
}
|
||||
|
||||
Button {
|
||||
@@ -507,6 +511,7 @@ struct EntryDetailView: View {
|
||||
)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.accessibilityIdentifier(AccessibilityID.EntryDetail.reflectionCard)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -526,6 +531,7 @@ struct EntryDetailView: View {
|
||||
.font(.subheadline)
|
||||
.fontWeight(.medium)
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityID.EntryDetail.photoButton)
|
||||
}
|
||||
.zIndex(1)
|
||||
|
||||
@@ -542,6 +548,7 @@ struct EntryDetailView: View {
|
||||
.onTapGesture {
|
||||
showFullScreenPhoto = true
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityID.EntryDetail.photoImage)
|
||||
} else {
|
||||
Button {
|
||||
showPhotoOptions = true
|
||||
@@ -568,22 +575,27 @@ struct EntryDetailView: View {
|
||||
)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.accessibilityIdentifier(AccessibilityID.EntryDetail.photoPlaceholder)
|
||||
}
|
||||
}
|
||||
.confirmationDialog("Photo", isPresented: $showPhotoOptions, titleVisibility: .visible) {
|
||||
Button("Take Photo") {
|
||||
showCamera = true
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityID.EntryDetail.photoTakeButton)
|
||||
Button("Choose from Library") {
|
||||
showPhotoPicker = true
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityID.EntryDetail.photoChooseButton)
|
||||
if let photoID = entry.photoID {
|
||||
Button("Remove Photo", role: .destructive) {
|
||||
_ = PhotoManager.shared.deletePhoto(id: photoID)
|
||||
_ = DataController.shared.updatePhoto(forDate: entry.forDate, photoID: nil)
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityID.EntryDetail.photoRemoveButton)
|
||||
}
|
||||
Button("Cancel", role: .cancel) { }
|
||||
.accessibilityIdentifier(AccessibilityID.EntryDetail.photoCancelButton)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -634,9 +646,11 @@ struct FullScreenPhotoView: View {
|
||||
.foregroundStyle(.white.opacity(0.8))
|
||||
.padding()
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityID.FullScreenPhoto.closeButton)
|
||||
}
|
||||
.onTapGesture {
|
||||
dismiss()
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityID.FullScreenPhoto.dismissArea)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user