Skip to content

Commit d028738

Browse files
authored
Add accessibility labels (#91)
* Add accessibility traits * Fix grouping for accessibility features * Add accessibilityIgnoresInvertColors to images
1 parent 605b659 commit d028738

File tree

8 files changed

+20
-0
lines changed

8 files changed

+20
-0
lines changed

MyLibrary/Sources/GuidanceFeature/Guidance.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ public struct GuidanceView: View {
276276
VStack(alignment: .leading) {
277277
Text("Directions", bundle: .module)
278278
.font(.headline)
279+
.accessibilityAddTraits(.isHeader)
279280
ForEach(store.lines.directions) { direction in
280281
VStack {
281282
HStack {

MyLibrary/Sources/LiveTranslationFeature/LiveTranslationView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,13 @@ public struct LiveTranslationView: View {
5656
.offset(x: -10)
5757
.aspectRatio(contentMode: .fit)
5858
.frame(maxHeight: 30)
59+
.accessibilityIgnoresInvertColors()
5960
Spacer()
6061
}
6162
.id(scrollContentBottomID)
6263
.padding(.bottom, 16)
64+
.accessibilityElement(children: .ignore)
65+
.accessibilityLabel(Text(verbatim: "Powered by Flitto"))
6366
}
6467
.onChange(of: viewModel.chatList.last) { old, new in
6568
guard old != .none else {

MyLibrary/Sources/ScheduleFeature/Detail.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public struct ScheduleDetailView: View {
6464
VStack(alignment: .leading, spacing: 16) {
6565
Text(LocalizedStringKey(store.title), bundle: .module)
6666
.font(.title.bold())
67+
.accessibilityAddTraits(.isHeader)
6768
Text(LocalizedStringKey(store.description), bundle: .module)
6869
.font(.callout)
6970
if let requirements = store.requirements {
@@ -101,6 +102,7 @@ public struct ScheduleDetailView: View {
101102
.aspectRatio(1.0, contentMode: .fit)
102103
.frame(width: 60)
103104
.clipShape(Circle())
105+
.accessibilityIgnoresInvertColors()
104106
VStack {
105107
Text(LocalizedStringKey(speaker.name), bundle: .module)
106108
.font(.title3.bold())
@@ -111,6 +113,7 @@ public struct ScheduleDetailView: View {
111113
Button(link.name) {
112114
send(.snsTapped(link.url))
113115
}
116+
.accessibilityAddTraits(.isLink)
114117
}
115118
}
116119
.frame(maxWidth: .infinity, alignment: .leading)

MyLibrary/Sources/ScheduleFeature/Schedule.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,12 @@ public struct ScheduleView: View {
174174
VStack(alignment: .leading, spacing: 8) {
175175
Text(conference.date, style: .date)
176176
.font(.title2)
177+
.accessibilityAddTraits(.isHeader)
177178
ForEach(conference.schedules, id: \.self) { schedule in
178179
VStack(alignment: .leading, spacing: 4) {
179180
Text(schedule.time, style: .time)
180181
.font(.subheadline.bold())
182+
.accessibilityAddTraits(.isHeader)
181183
ForEach(schedule.sessions, id: \.self) { session in
182184
if session.description != nil {
183185
Button {
@@ -220,13 +222,17 @@ public struct ScheduleView: View {
220222
.clipShape(Circle())
221223
)
222224
.frame(width: 60)
225+
.accessibilityElement(children: .ignore)
226+
.accessibilityIgnoresInvertColors()
223227
}
224228
} else {
225229
Image(.tokyo)
226230
.resizable()
227231
.aspectRatio(contentMode: .fit)
228232
.clipShape(Circle())
229233
.frame(width: 60)
234+
.accessibilityElement(children: .ignore)
235+
.accessibilityIgnoresInvertColors()
230236
}
231237
}
232238
VStack(alignment: .leading) {
@@ -257,6 +263,7 @@ public struct ScheduleView: View {
257263
}
258264
}
259265
.frame(maxWidth: .infinity, alignment: .leading)
266+
.accessibilityElement(children: .combine)
260267
}
261268
}
262269

MyLibrary/Sources/SponsorFeature/Sponsors.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public struct SponsorsListView: View {
8686
.font(.title.bold())
8787
.padding(.top, 64)
8888
.foregroundStyle(Color.black)
89+
.accessibilityAddTraits(.isHeader)
8990
LazyVGrid(
9091
columns: Array(repeating: plan.gridItem, count: plan.columnCount),
9192
spacing: 64
@@ -98,6 +99,8 @@ public struct SponsorsListView: View {
9899
.onTapGesture {
99100
send(.sponsorTapped(sponsor))
100101
}
102+
.accessibilityAddTraits(.isLink)
103+
.accessibilityIgnoresInvertColors()
101104
}
102105
}
103106
.background(Color.white)

MyLibrary/Sources/trySwiftFeature/Organizers.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public struct OrganizersView: View {
7878
.resizable()
7979
.aspectRatio(contentMode: .fit)
8080
.clipShape(Circle())
81+
.accessibilityIgnoresInvertColors()
8182
}
8283
}
8384
}

MyLibrary/Sources/trySwiftFeature/Profile.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public struct ProfileView: View {
5858
.resizable()
5959
.aspectRatio(1.0, contentMode: .fill)
6060
.frame(maxWidth: 400)
61+
.accessibilityIgnoresInvertColors()
6162
VStack {
6263
if let links = store.organizer.links {
6364
HStack {

MyLibrary/Sources/trySwiftFeature/trySwift.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public struct TrySwiftView: View {
119119
.resizable()
120120
.aspectRatio(contentMode: .fit)
121121
.frame(maxWidth: 400, alignment: .center)
122+
.accessibilityIgnoresInvertColors()
122123
Spacer()
123124
}
124125
Text("try! Swift Description", bundle: .module)

0 commit comments

Comments
 (0)