Commit 286c337359

286c3373599a86385a24ab7d92c1f6418876d44e

parent: 741248a32f

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-22 20:53 UTC

Accessibility labels for complications and widget rows

A Today row, a habit and each complication read as one element; a habit's
label adds today's state, and circular and corner complications say how many
entries are open today.

Ref #221

Layout: unified · split

Sources/OrgstarWatchWidgets/WatchWidgets.swift +7
@@ -68,14 +68,18 @@ struct NextEntryView: View {
68 Text("open").font(.caption2) 68 Text("open").font(.caption2)
69 } 69 }
70 } 70 }
71 .accessibilityElement(children: .ignore)
72 .accessibilityLabel(Text("\(open) open today"))
71 case .accessoryCorner: 73 case .accessoryCorner:
72 Text("\(open)").font(.title3.weight(.semibold)).widgetLabel { Text(next?.title ?? String(localized: "Agenda clear")) } 74 Text("\(open)").font(.title3.weight(.semibold)).widgetLabel { Text(next?.title ?? String(localized: "Agenda clear")) }
75 .accessibilityLabel(Text("\(open) open today") + Text(verbatim: next.map { ", \($0.title)" } ?? ""))
73 default: 76 default:
74 VStack(alignment: .leading, spacing: 0) { 77 VStack(alignment: .leading, spacing: 0) {
75 Text(next?.gutter ?? String(localized: "Agenda")).font(.headline).widgetAccentable().lineLimit(1) 78 Text(next?.gutter ?? String(localized: "Agenda")).font(.headline).widgetAccentable().lineLimit(1)
76 Text(next?.title ?? (entry.agenda == nil ? String(localized: "Open orgstar") : String(localized: "Nothing left today"))).lineLimit(2) 79 Text(next?.title ?? (entry.agenda == nil ? String(localized: "Open orgstar") : String(localized: "Nothing left today"))).lineLimit(2)
77 } 80 }
78 .frame(maxWidth: .infinity, alignment: .leading) 81 .frame(maxWidth: .infinity, alignment: .leading)
82 .accessibilityElement(children: .combine)
79 } 83 }
80 } 84 }
81} 85}
@@ -109,6 +113,8 @@ struct ClockView: View {
109 Image(systemName: "stopwatch").font(.title3) 113 Image(systemName: "stopwatch").font(.title3)
110 } 114 }
111 } 115 }
116 .accessibilityElement(children: .ignore)
117 .accessibilityLabel(clock.map { Text("Clocked in") + Text(verbatim: ", \($0.heading), ") + Text($0.startedAt, style: .timer) } ?? Text("Not clocked in"))
112 default: 118 default:
113 VStack(alignment: .leading, spacing: 0) { 119 VStack(alignment: .leading, spacing: 0) {
114 if let clock { 120 if let clock {
@@ -120,6 +126,7 @@ struct ClockView: View {
120 } 126 }
121 } 127 }
122 .frame(maxWidth: .infinity, alignment: .leading) 128 .frame(maxWidth: .infinity, alignment: .leading)
129 .accessibilityElement(children: .combine)
123 } 130 }
124 } 131 }
125} 132}
Sources/OrgstarWidgets/HabitsWidget.swift +18 −3
@@ -91,14 +91,16 @@ struct HabitsView: View {
91 let cells = habit.habit.graph(today: today, preceding: 6, following: 1) 91 let cells = habit.habit.graph(today: today, preceding: 6, following: 1)
92 VStack(alignment: .leading, spacing: 2) { 92 VStack(alignment: .leading, spacing: 2) {
93 Text(habit.title).font(.caption).lineLimit(1) 93 Text(habit.title).font(.caption).lineLimit(1)
94 HabitCells(cells: cells, colors: snapshot.colors, width: 12, height: 8) 94 HabitCells(cells: cells, today: today, colors: snapshot.colors, width: 12, height: 8)
95 } 95 }
96 .accessibilityElement(children: .combine)
96 } else { 97 } else {
97 HStack(spacing: 8) { 98 HStack(spacing: 8) {
98 Text(habit.title).font(.caption).lineLimit(1) 99 Text(habit.title).font(.caption).lineLimit(1)
99 Spacer(minLength: 4) 100 Spacer(minLength: 4)
100 HabitCells(cells: habit.habit.graph(today: today), colors: snapshot.colors, width: 5, height: 12) 101 HabitCells(cells: habit.habit.graph(today: today), today: today, colors: snapshot.colors, width: 5, height: 12)
101 } 102 }
103 .accessibilityElement(children: .combine)
102 } 104 }
103 } 105 }
104} 106}
@@ -109,6 +111,7 @@ struct HabitsView: View {
109/// from clear (faintest) to overdue (solid), and days to come are outlined. 111/// from clear (faintest) to overdue (solid), and days to come are outlined.
110struct HabitCells: View { 112struct HabitCells: View {
111 let cells: [Habit.Cell] 113 let cells: [Habit.Cell]
114 let today: Int
112 let colors: [String: AgendaSnapshot.Hex] 115 let colors: [String: AgendaSnapshot.Hex]
113 let width: CGFloat 116 let width: CGFloat
114 let height: CGFloat 117 let height: CGFloat
@@ -137,7 +140,19 @@ struct HabitCells: View {
137 } 140 }
138 } 141 }
139 .accessibilityElement(children: .ignore) 142 .accessibilityElement(children: .ignore)
140 .accessibilityLabel("Done \(cells.filter { $0.glyph == "*" }.count) of \(cells.count) days") 143 .accessibilityLabel(Text("Done \(cells.filter { $0.glyph == "*" }.count) of \(cells.count) days") + Text(verbatim: ", ") + todayState)
144 }
145
146 /// Today's state in words.
147 private var todayState: Text {
148 guard let cell = cells.first(where: { $0.day == today }) else { return Text(verbatim: "") }
149 if cell.glyph == "*" { return Text("Done today") }
150 switch cell.face {
151 case .clear, .clearFuture: return Text("Not due today")
152 case .ready, .readyFuture: return Text("Due today")
153 case .alert, .alertFuture: return Text("Last chance today")
154 case .overdue, .overdueFuture: return Text("Overdue")
155 }
141 } 156 }
142 157
143 /// A filled bar for past days and an outline for days to come, at the state's step; a 158 /// A filled bar for past days and an outline for days to come, at the state's step; a
Sources/OrgstarWidgets/TodayWidget.swift +13
@@ -114,6 +114,7 @@ struct SmallRow: View {
114 .foregroundStyle(row.statusColor?.color(scheme) ?? .secondary) 114 .foregroundStyle(row.statusColor?.color(scheme) ?? .secondary)
115 Text(row.title).font(.caption).lineLimit(1) 115 Text(row.title).font(.caption).lineLimit(1)
116 } 116 }
117 .accessibilityElement(children: .combine)
117 } 118 }
118} 119}
119 120
@@ -153,6 +154,18 @@ struct WideRow: View {
153 Spacer(minLength: 0) 154 Spacer(minLength: 0)
154 Circle().fill(row.categoryColor?.color(scheme) ?? .secondary).frame(width: categoryDot, height: categoryDot) 155 Circle().fill(row.categoryColor?.color(scheme) ?? .secondary).frame(width: categoryDot, height: categoryDot)
155 } 156 }
157 .accessibilityElement(children: .ignore)
158 .accessibilityLabel(label)
159 }
160
161 /// The time or status, keyword, priority, title and category, as one phrase.
162 private var label: Text {
163 var parts = [Text(verbatim: row.gutter)]
164 if let todo = row.todo { parts.append(Text(verbatim: todo)) }
165 if let priority = row.priority { parts.append(Text("Priority \(priority)")) }
166 parts.append(Text(verbatim: row.title))
167 if !row.category.isEmpty { parts.append(Text(verbatim: row.category)) }
168 return parts.dropFirst().reduce(parts[0]) { $0 + Text(verbatim: ", ") + $1 }
156 } 169 }
157} 170}
158 171
docs/manual/guide/14-ios.org +1 −1
@@ -225,7 +225,7 @@ Tapping a row in the medium or large Today widget opens that entry; tapping else
225 225
226Widgets can't read your folders, so the app writes the next seven days of the agenda (today included) for them to read: while it is open, when files, edits or settings change, when you return to the app, and every hour. Between those times the widgets move on by themselves as timed entries end and at midnight, but they show nothing new until you open orgstar. Until the app has written the agenda once, they say =Open orgstar to show your agenda here.= The widgets ignore the agenda's filter and show no days without entries. The Habits widget's graphs move on at midnight by themselves. 226Widgets can't read your folders, so the app writes the next seven days of the agenda (today included) for them to read: while it is open, when files, edits or settings change, when you return to the app, and every hour. Between those times the widgets move on by themselves as timed entries end and at midnight, but they show nothing new until you open orgstar. Until the app has written the agenda once, they say =Open orgstar to show your agenda here.= The widgets ignore the agenda's filter and show no days without entries. The Habits widget's graphs move on at midnight by themselves.
227 227
228In the Habits graph a day's bar has the colour of its state: not yet due, due, due today for the last time, or overdue; days to come are lighter. In the tinted and clear Home Screen styles, and with Differentiate Without Colour on (Settings ▸ Accessibility ▸ Display & Text Size), the states are also told apart by how solid the bar is, from not yet due (faintest) to overdue (solid), and days to come are outlined. In the tinted style, the Today widget's date and the Habits title take the tint. 228In the Habits graph a day's bar has the colour of its state: not yet due, due, due today for the last time, or overdue; days to come are lighter. In the tinted and clear Home Screen styles, and with Differentiate Without Colour on (Settings ▸ Accessibility ▸ Display & Text Size), the states are also told apart by how solid the bar is, from not yet due (faintest) to overdue (solid), and days to come are outlined. In the tinted style, the Today widget's date and the Habits title take the tint. VoiceOver reads each row of the Today widget, each habit and each complication as one item; a habit with how many of the days shown were done and today's state.
229 229
230** Controls 230** Controls
231 231
l10n/Localizable.xcstrings +102
@@ -10694,6 +10694,40 @@
10694 } 10694 }
10695 } 10695 }
10696 }, 10696 },
10697 "Done today": {
10698 "localizations": {
10699 "de": {
10700 "stringUnit": {
10701 "state": "translated",
10702 "value": "Heute erledigt"
10703 }
10704 },
10705 "es": {
10706 "stringUnit": {
10707 "state": "translated",
10708 "value": "Hecho hoy"
10709 }
10710 },
10711 "fr": {
10712 "stringUnit": {
10713 "state": "translated",
10714 "value": "Effectuée aujourd'hui"
10715 }
10716 },
10717 "ja": {
10718 "stringUnit": {
10719 "state": "translated",
10720 "value": "今日は完了"
10721 }
10722 },
10723 "pt-BR": {
10724 "stringUnit": {
10725 "state": "translated",
10726 "value": "Concluído hoje"
10727 }
10728 }
10729 }
10730 },
10697 "Doom's own org defaults are read from the folder Doom is installed in": { 10731 "Doom's own org defaults are read from the folder Doom is installed in": {
10698 "localizations": { 10732 "localizations": {
10699 "de": { 10733 "de": {
@@ -17252,6 +17286,40 @@
17252 } 17286 }
17253 } 17287 }
17254 }, 17288 },
17289 "Last chance today": {
17290 "localizations": {
17291 "de": {
17292 "stringUnit": {
17293 "state": "translated",
17294 "value": "Heute letzte Gelegenheit"
17295 }
17296 },
17297 "es": {
17298 "stringUnit": {
17299 "state": "translated",
17300 "value": "Última oportunidad hoy"
17301 }
17302 },
17303 "fr": {
17304 "stringUnit": {
17305 "state": "translated",
17306 "value": "Dernière chance aujourd'hui"
17307 }
17308 },
17309 "ja": {
17310 "stringUnit": {
17311 "state": "translated",
17312 "value": "今日が最後の機会"
17313 }
17314 },
17315 "pt-BR": {
17316 "stringUnit": {
17317 "state": "translated",
17318 "value": "Última chance hoje"
17319 }
17320 }
17321 }
17322 },
17255 "Later": { 17323 "Later": {
17256 "localizations": { 17324 "localizations": {
17257 "de": { 17325 "de": {
@@ -21927,6 +21995,40 @@
21927 } 21995 }
21928 } 21996 }
21929 }, 21997 },
21998 "Not due today": {
21999 "localizations": {
22000 "de": {
22001 "stringUnit": {
22002 "state": "translated",
22003 "value": "Heute nicht fällig"
22004 }
22005 },
22006 "es": {
22007 "stringUnit": {
22008 "state": "translated",
22009 "value": "No vence hoy"
22010 }
22011 },
22012 "fr": {
22013 "stringUnit": {
22014 "state": "translated",
22015 "value": "Pas d'échéance aujourd'hui"
22016 }
22017 },
22018 "ja": {
22019 "stringUnit": {
22020 "state": "translated",
22021 "value": "今日は期限なし"
22022 }
22023 },
22024 "pt-BR": {
22025 "stringUnit": {
22026 "state": "translated",
22027 "value": "Não vence hoje"
22028 }
22029 }
22030 }
22031 },
21930 "Not imported": { 22032 "Not imported": {
21931 "localizations": { 22033 "localizations": {
21932 "de": { 22034 "de": {