Commit 8714ee0921

8714ee09211f42f94ac2c75672f19c309b84860b

parent: 62244b4dc2

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-25 22:14 UTC

Mac: keyboard access to tabs, board cards and inspector rows

Tab names are buttons and the close button has a 20 pt hit area. The
outline divider is an adjustable "Outline width" for VoiceOver. The
inspector's Columns tab is a table and its Clock tab a selectable
list: selecting a row with the mouse or the arrow keys goes to it,
Return goes to it again. On the kanban board the arrow keys select
cards, Return opens one, and Shift-Left and Shift-Right move it to the
column before or after.

Ref #221

Layout: unified · split

Changed files (9)
Sources/Orgstar/BoardView.swift +58 −7 · view
@@ -18,6 +18,9 @@ struct BoardView: View {
18 @State private var sortOrder = [KeyPathComparator(\BoardRow.todoOrder), KeyPathComparator(\BoardRow.title)] 18 @State private var sortOrder = [KeyPathComparator(\BoardRow.todoOrder), KeyPathComparator(\BoardRow.title)]
19 @State private var message: String? 19 @State private var message: String?
20 @State private var tick = 0 20 @State private var tick = 0
21 /// The kanban card the arrow keys move from.
22 @State private var current: String?
23 @FocusState private var boardFocused: Bool
21 @AppStorage("boardKanban") private var kanban = false 24 @AppStorage("boardKanban") private var kanban = false
22 @AppStorage("boardMatch") private var match = "" 25 @AppStorage("boardMatch") private var match = ""
23 @AppStorage("boardColumns") private var columnText = "EFFORT" 26 @AppStorage("boardColumns") private var columnText = "EFFORT"
@@ -131,15 +134,54 @@ struct BoardView: View {
131 // MARK: - Kanban 134 // MARK: - Kanban
132 135
133 private var board: some View { 136 private var board: some View {
134 ScrollView(.horizontal) { 137 ScrollViewReader { proxy in
135 HStack(alignment: .top, spacing: 12) { 138 ScrollView(.horizontal) {
136 ForEach(keywords, id: \.self) { keyword in 139 HStack(alignment: .top, spacing: 12) {
137 column(keyword) 140 ForEach(keywords, id: \.self) { keyword in
141 column(keyword)
142 }
138 } 143 }
144 .padding(12)
145 }
146 .onChange(of: current) {
147 if let current { proxy.scrollTo(current) }
139 } 148 }
140 .padding(12)
141 } 149 }
142 .background(theme.color("agenda-background", in: colorScheme) ?? .clear) 150 .background(theme.color("agenda-background", in: colorScheme) ?? .clear)
151 .focusable()
152 .focused($boardFocused)
153 .focusEffectDisabled()
154 .onKeyPress(phases: .down) { press in handle(press) }
155 }
156
157 /// The arrow keys move between cards, Shift-Left and Shift-Right move the card to the
158 /// column before or after, Return opens it.
159 private func handle(_ press: KeyPress) -> KeyPress.Result {
160 let columns = keywords.map { keyword in entries.filter { $0.todo == keyword } }
161 let arrows: [KeyEquivalent] = [.upArrow, .downArrow, .leftArrow, .rightArrow]
162 guard let c = columns.firstIndex(where: { $0.contains { $0.id == current } }),
163 let r = columns[c].firstIndex(where: { $0.id == current }) else {
164 guard arrows.contains(press.key), press.modifiers.isEmpty, let first = columns.lazy.compactMap(\.first).first else { return .ignored }
165 current = first.id
166 return .handled
167 }
168 let entry = columns[c][r]
169 let step = press.key == .leftArrow ? -1 : 1
170 if press.key == .return, press.modifiers.isEmpty {
171 jump(entry)
172 } else if press.modifiers == .shift, press.key == .leftArrow || press.key == .rightArrow {
173 if keywords.indices.contains(c + step) { setTodo(entry, keywords[c + step]) }
174 } else if press.modifiers.isEmpty, press.key == .upArrow || press.key == .downArrow {
175 current = columns[c][min(max(r + (press.key == .upArrow ? -1 : 1), 0), columns[c].count - 1)].id
176 } else if press.modifiers.isEmpty, press.key == .leftArrow || press.key == .rightArrow {
177 // The nearest column with cards, at the same height.
178 var k = c + step
179 while columns.indices.contains(k), columns[k].isEmpty { k += step }
180 if columns.indices.contains(k) { current = columns[k][min(r, columns[k].count - 1)].id }
181 } else {
182 return .ignored
183 }
184 return .handled
143 } 185 }
144 186
145 private func column(_ keyword: String) -> some View { 187 private func column(_ keyword: String) -> some View {
@@ -153,10 +195,15 @@ struct BoardView: View {
153 VStack(alignment: .leading, spacing: 6) { 195 VStack(alignment: .leading, spacing: 6) {
154 ForEach(cards) { entry in 196 ForEach(cards) { entry in
155 card(entry) 197 card(entry)
198 .id(entry.id)
156 .draggable(entry.id) 199 .draggable(entry.id)
157 .onTapGesture(count: 2) { jump(entry) } 200 .onTapGesture(count: 2) { jump(entry) }
201 .simultaneousGesture(TapGesture().onEnded {
202 current = entry.id
203 boardFocused = true
204 })
158 .accessibilityElement(children: .combine) 205 .accessibilityElement(children: .combine)
159 .accessibilityAddTraits(.isButton) 206 .accessibilityAddTraits(current == entry.id ? [.isButton, .isSelected] : .isButton)
160 .accessibilityAction { jump(entry) } 207 .accessibilityAction { jump(entry) }
161 .accessibilityActions { 208 .accessibilityActions {
162 // Dragging between columns, for VoiceOver. 209 // Dragging between columns, for VoiceOver.
@@ -181,7 +228,8 @@ struct BoardView: View {
181 } 228 }
182 229
183 private func card(_ entry: BoardEntry) -> some View { 230 private func card(_ entry: BoardEntry) -> some View {
184 VStack(alignment: .leading, spacing: 4) { 231 let selected = current == entry.id
232 return VStack(alignment: .leading, spacing: 4) {
185 Text((entry.priority.map { "[#\($0)] " } ?? "") + entry.title).lineLimit(3) 233 Text((entry.priority.map { "[#\($0)] " } ?? "") + entry.title).lineLimit(3)
186 HStack(spacing: 6) { 234 HStack(spacing: 6) {
187 Text(entry.category).font(.caption).foregroundStyle(.secondary) 235 Text(entry.category).font(.caption).foregroundStyle(.secondary)
@@ -198,6 +246,9 @@ struct BoardView: View {
198 .padding(8) 246 .padding(8)
199 .frame(maxWidth: .infinity, alignment: .leading) 247 .frame(maxWidth: .infinity, alignment: .leading)
200 .background(RoundedRectangle(cornerRadius: 6).fill(Color(nsColor: .controlBackgroundColor))) 248 .background(RoundedRectangle(cornerRadius: 6).fill(Color(nsColor: .controlBackgroundColor)))
249 .overlay {
250 if selected { RoundedRectangle(cornerRadius: 6).strokeBorder(theme.color("accent") ?? .accentColor, lineWidth: 2) }
251 }
201 } 252 }
202 253
203 // MARK: - Editing 254 // MARK: - Editing
Sources/Orgstar/BufferTabs.swift +15 −7 · view
@@ -22,7 +22,13 @@ struct PaneDivider: View {
22 start = base 22 start = base
23 width = min(max(base + drag.translation.width, range.lowerBound), range.upperBound) 23 width = min(max(base + drag.translation.width, range.lowerBound), range.upperBound)
24 }.onEnded { _ in start = nil })) 24 }.onEnded { _ in start = nil }))
25 .accessibilityHidden(true) 25 .accessibilityElement()
26 .accessibilityLabel("Outline width")
27 .accessibilityValue("\(Int(width)) points")
28 .accessibilityAdjustableAction { direction in
29 let step = direction == .increment ? 20.0 : -20.0
30 width = min(max(width + step, range.lowerBound), range.upperBound)
31 }
26 } 32 }
27} 33}
28 34
@@ -50,25 +56,27 @@ struct BufferTabs: View {
50 56
51 private func tab(_ path: String) -> some View { 57 private func tab(_ path: String) -> some View {
52 let current = path == pane.path 58 let current = path == pane.path
53 return HStack(spacing: 6) { 59 return HStack(spacing: 2) {
54 Text(session.bufferName(path)) 60 Button(session.bufferName(path)) { session.open(path, in: pane) }
61 .buttonStyle(.plain)
55 .lineLimit(1) 62 .lineLimit(1)
56 .foregroundStyle(current ? .primary : .secondary) 63 .foregroundStyle(current ? .primary : .secondary)
57 .accessibilityAddTraits(current ? [.isButton, .isSelected] : .isButton) 64 .accessibilityAddTraits(current ? .isSelected : [])
58 .accessibilityAction { session.open(path, in: pane) }
59 Button { 65 Button {
60 close(path) 66 close(path)
61 } label: { 67 } label: {
62 Image(systemName: session.dirtyPaths.contains(path) ? "circle.fill" : "xmark") 68 Image(systemName: session.dirtyPaths.contains(path) ? "circle.fill" : "xmark")
63 .font(.system(size: session.dirtyPaths.contains(path) ? 6 : 9, weight: .semibold)) 69 .font(.system(size: session.dirtyPaths.contains(path) ? 6 : 9, weight: .semibold))
64 .frame(width: 12, height: 12) 70 .frame(width: 20, height: 20)
71 .contentShape(Rectangle())
65 } 72 }
66 .buttonStyle(.borderless) 73 .buttonStyle(.borderless)
67 .help("Close") 74 .help("Close")
68 .accessibilityLabel("Close \(session.bufferName(path))" + (session.dirtyPaths.contains(path) ? ", unsaved" : "")) 75 .accessibilityLabel("Close \(session.bufferName(path))" + (session.dirtyPaths.contains(path) ? ", unsaved" : ""))
69 } 76 }
70 .font(.callout) 77 .font(.callout)
71 .padding(.horizontal, 12) 78 .padding(.leading, 12)
79 .padding(.trailing, 6)
72 .frame(maxHeight: .infinity) 80 .frame(maxHeight: .infinity)
73 // A shape, not a color: a color background runs up under the toolbar. 81 // A shape, not a color: a color background runs up under the toolbar.
74 .background { Rectangle().fill(current ? theme.color("background") ?? Color(nsColor: .textBackgroundColor) : .clear) } 82 .background { Rectangle().fill(current ? theme.color("background") ?? Color(nsColor: .textBackgroundColor) : .clear) }
Sources/Orgstar/InspectorPane.swift +29 −29 · view
@@ -14,6 +14,15 @@ struct InspectorPane: View {
14 @AppStorage("inspectorClockSpan") private var span = Span.week 14 @AppStorage("inspectorClockSpan") private var span = Span.week
15 @State private var columns: ColumnView.View? 15 @State private var columns: ColumnView.View?
16 @State private var clocked: [(start: Int, heading: String, minutes: Int)] = [] 16 @State private var clocked: [(start: Int, heading: String, minutes: Int)] = []
17 /// The selected row's heading start, in each tab.
18 @State private var selectedRow: Int?
19 @State private var selectedClock: Int?
20
21 /// A column view row, identified by its heading.
22 private struct ColumnRow: Identifiable {
23 let row: ColumnView.Row
24 var id: Int { row.start }
25 }
17 26
18 enum Tab: String, CaseIterable { 27 enum Tab: String, CaseIterable {
19 case columns = "Columns", clock = "Clock" 28 case columns = "Columns", clock = "Clock"
@@ -79,33 +88,22 @@ struct InspectorPane: View {
79 .padding(.horizontal, 8) 88 .padding(.horizontal, 8)
80 .padding(.bottom, 6) 89 .padding(.bottom, 6)
81 if let columns, !columns.rows.isEmpty { 90 if let columns, !columns.rows.isEmpty {
82 ScrollView([.horizontal, .vertical]) { 91 // A table, so the arrow keys move through the rows; selecting one goes to it.
83 Grid(alignment: .leading, horizontalSpacing: 10, verticalSpacing: 3) { 92 Table(columns.rows.map(ColumnRow.init), selection: $selectedRow) {
84 GridRow { 93 TableColumnForEach(columns.specs.indices, id: \.self) { i in
85 ForEach(columns.specs.indices, id: \.self) { i in 94 TableColumn(columns.specs[i].title) { (item: ColumnRow) in
86 Text(columns.specs[i].title).bold().foregroundStyle(.secondary) 95 let row = item.row
87 } 96 Text(columns.specs[i].property == "ITEM" ? String(repeating: "*", count: row.level) + " " + row.values[i] : row.values[i])
88 } 97 .lineLimit(1)
89 Divider() 98 .fontWeight(row.start == heading ? .semibold : .regular)
90 ForEach(columns.rows.indices, id: \.self) { r in
91 let row = columns.rows[r]
92 GridRow {
93 ForEach(columns.specs.indices, id: \.self) { i in
94 Text(columns.specs[i].property == "ITEM" ? String(repeating: "*", count: row.level) + " " + row.values[i] : row.values[i])
95 .lineLimit(1)
96 .fontWeight(row.start == heading ? .semibold : .regular)
97 }
98 }
99 .contentShape(Rectangle())
100 .onTapGesture { session.reveal(row.start) }
101 .accessibilityAddTraits(.isButton)
102 .accessibilityAction { session.reveal(row.start) }
103 } 99 }
104 } 100 }
105 .font(.system(.callout, design: .monospaced))
106 .padding(8)
107 } 101 }
108 .defaultScrollAnchor(.topLeading) 102 .font(.system(.callout, design: .monospaced))
103 .onChange(of: selectedRow) { if let selectedRow { session.reveal(selectedRow) } }
104 .contextMenu(forSelectionType: Int.self) { _ in } primaryAction: { starts in
105 if let start = starts.first { session.reveal(start) }
106 }
109 } else { 107 } else {
110 ContentUnavailableView("No entries", systemImage: "tablecells") 108 ContentUnavailableView("No entries", systemImage: "tablecells")
111 } 109 }
@@ -122,7 +120,8 @@ struct InspectorPane: View {
122 if clocked.isEmpty { 120 if clocked.isEmpty {
123 ContentUnavailableView("No clocked time", systemImage: "clock") 121 ContentUnavailableView("No clocked time", systemImage: "clock")
124 } else { 122 } else {
125 List { 123 // A selectable list, so the arrow keys move through the headings; selecting one goes to it.
124 List(selection: $selectedClock) {
126 ForEach(clocked, id: \.start) { entry in 125 ForEach(clocked, id: \.start) { entry in
127 HStack { 126 HStack {
128 Text(entry.heading.isEmpty ? String(localized: "(untitled)") : entry.heading).lineLimit(1) 127 Text(entry.heading.isEmpty ? String(localized: "(untitled)") : entry.heading).lineLimit(1)
@@ -130,11 +129,8 @@ struct InspectorPane: View {
130 Text(ClockReport.hours(entry.minutes)).monospacedDigit() 129 Text(ClockReport.hours(entry.minutes)).monospacedDigit()
131 } 130 }
132 .fontWeight(entry.start == heading ? .semibold : .regular) 131 .fontWeight(entry.start == heading ? .semibold : .regular)
133 .contentShape(Rectangle())
134 .onTapGesture { session.reveal(entry.start) }
135 .accessibilityElement(children: .combine) 132 .accessibilityElement(children: .combine)
136 .accessibilityAddTraits(.isButton) 133 .tag(entry.start)
137 .accessibilityAction { session.reveal(entry.start) }
138 } 134 }
139 HStack { 135 HStack {
140 Text("Total").bold() 136 Text("Total").bold()
@@ -142,6 +138,10 @@ struct InspectorPane: View {
142 Text(ClockReport.hours(clocked.reduce(0) { $0 + $1.minutes })).bold().monospacedDigit() 138 Text(ClockReport.hours(clocked.reduce(0) { $0 + $1.minutes })).bold().monospacedDigit()
143 } 139 }
144 } 140 }
141 .onChange(of: selectedClock) { if let selectedClock { session.reveal(selectedClock) } }
142 .contextMenu(forSelectionType: Int.self) { _ in } primaryAction: { starts in
143 if let start = starts.first { session.reveal(start) }
144 }
145 } 145 }
146 } 146 }
147 147
docs/manual/guide/01-files-and-folders.org +1 −1 · view
@@ -40,7 +40,7 @@ Several commands in this chapter are only in the palette, not in a menu: Close O
40 40
41The toolbar's outline button does the same as View ▸ Show Outline. The sidebar is shown and hidden with the standard View menu command. The button at the right of the bar under it switches it between the files and an agenda; see [[file:07-agenda.org][The agenda]]. 41The toolbar's outline button does the same as View ▸ Show Outline. The sidebar is shown and hidden with the standard View menu command. The button at the right of the bar under it switches it between the files and an agenda; see [[file:07-agenda.org][The agenda]].
42 42
43orgstar remembers whether the outline, backlinks and inspector are shown. The outline pane's visibility is remembered for org files only: for other files it starts hidden each time you open one. Drag the divider on the outline pane's right edge to resize it (160 to 400 points; 220 by default). 43orgstar remembers whether the outline, backlinks and inspector are shown. The outline pane's visibility is remembered for org files only: for other files it starts hidden each time you open one. Drag the divider on the outline pane's right edge to resize it (160 to 400 points; 220 by default). VoiceOver reads the divider as Outline width, which it adjusts in steps of 20 points.
44 44
45* Folders 45* Folders
46 46
docs/manual/guide/02-the-editor.org +1 −1 · view
@@ -395,6 +395,6 @@ To search all your files, use the toolbar's search field; see [[file:01-files-an
395 395
396The editor works with VoiceOver. VoiceOver reads the text as it is shown rather than as stored: hidden link brackets and targets, hidden emphasis markers and hidden stars are skipped, entities are read as the characters drawn for them, and narrowed table columns are read as drawn. Folded text is still read, so the whole file is available. Lines, the caret position and the selection are reported in terms of the shown text. 396The editor works with VoiceOver. VoiceOver reads the text as it is shown rather than as stored: hidden link brackets and targets, hidden emphasis markers and hidden stars are skipped, entities are read as the characters drawn for them, and narrowed table columns are read as drawn. Folded text is still read, so the whole file is available. Lines, the caret position and the selection are reported in terms of the shown text.
397 397
398Other parts of the window are labelled: tabs in the tab bar are buttons, with the current one marked selected, and each close button names its buffer and says whether it is unsaved; the modeline's unsaved dot reads "Unsaved changes", and the Doom state tag reads, for example, "Normal state". 398Other parts of the window are labelled: tabs in the tab bar are buttons, with the current one marked selected, and each close button names its buffer and says whether it is unsaved; the outline pane's divider is an adjustable Outline width; the modeline's unsaved dot reads "Unsaved changes", and the Doom state tag reads, for example, "Normal state".
399 399
400The editor keeps the system's keyboard navigation and text editing; the presets only add bindings. See [[file:03-keys.org][Keys and commands]]. 400The editor keeps the system's keyboard navigation and text editing; the presets only add bindings. See [[file:03-keys.org][Keys and commands]].
docs/manual/guide/04-outlines.org +2 −1 · view
@@ -706,7 +706,8 @@ for the value with the allowed values listed, Previous Value and Next Value (=p=
706View ▸ Show Columns and Clock opens an inspector beside the editor. Its Columns 706View ▸ Show Columns and Clock opens an inspector beside the editor. Its Columns
707tab shows the same table for the open file, kept current as you type. Choose File for 707tab shows the same table for the open file, kept current as you type. Choose File for
708every entry or Subtree for the entry at the caret. The row of the heading at the caret 708every entry or Subtree for the entry at the caret. The row of the heading at the caret
709is shown in bold, and clicking a row goes to it. The Clock tab is described in 709is shown in bold. Selecting a row, by clicking it or with the arrow keys, goes to it;
710=Return= or a double-click goes to the selected row again. The Clock tab is described in
710[[file:06-dates-and-clocking.org][Dates and clocking]]. 711[[file:06-dates-and-clocking.org][Dates and clocking]].
711 712
712** Column view tables 713** Column view tables
docs/manual/guide/06-dates-and-clocking.org +1 −1 · view
@@ -416,7 +416,7 @@ A line of the form ~CLOCK: => 1:15~, with only a duration, counts towards clock
416 416
417** The inspector 417** The inspector
418 418
419View ▸ Show Columns and Clock opens the inspector beside the editor. Its Clock tab lists the clocked time per heading in the open file for Today, This Week (weeks start on Monday) or All, with a total. Clicking a heading moves to it. Only finished clocks count. 419View ▸ Show Columns and Clock opens the inspector beside the editor. Its Clock tab lists the clocked time per heading in the open file for Today, This Week (weeks start on Monday) or All, with a total. Selecting a heading, by clicking it or with the arrow keys, moves to it. Only finished clocks count.
420 420
421** The clock report window 421** The clock report window
422 422
docs/manual/guide/07-agenda.org +2 · view
@@ -704,6 +704,8 @@ Columns: TODO, priority, title, tags, scheduled, deadline, your property columns
704 704
705Each TODO keyword your files use gets a column, in sequence order, done keywords included. A card shows the priority and title, the category and tags, and the deadline (in red) or the scheduled date. Drag a card to another column to set that keyword; this is the same edit as changing the state in the editor, so logging and state-change notes apply (a note is asked for in the main window). Double-click a card to open its entry. With VoiceOver, each card has a Move to … action for each other column. 705Each TODO keyword your files use gets a column, in sequence order, done keywords included. A card shows the priority and title, the category and tags, and the deadline (in red) or the scheduled date. Drag a card to another column to set that keyword; this is the same edit as changing the state in the editor, so logging and state-change notes apply (a note is asked for in the main window). Double-click a card to open its entry. With VoiceOver, each card has a Move to … action for each other column.
706 706
707From the keyboard, click a card or press an arrow key to select one. The arrow keys move between cards, =Return= opens the selected card's entry, and =⇧←= and =⇧→= move it to the column before or after, as dragging does.
708
707With a match that includes entries without a TODO keyword, those entries appear in the table but not on the kanban board, which has no column for them. 709With a match that includes entries without a TODO keyword, those entries appear in the table but not on the kanban board, which has no column for them.
708 710
709** On iOS 711** On iOS
l10n/Localizable.xcstrings +68 · view
@@ -1684,6 +1684,40 @@
1684 } 1684 }
1685 } 1685 }
1686 }, 1686 },
1687 "%lld points": {
1688 "localizations": {
1689 "de": {
1690 "stringUnit": {
1691 "state": "translated",
1692 "value": "%lld Punkte"
1693 }
1694 },
1695 "es": {
1696 "stringUnit": {
1697 "state": "translated",
1698 "value": "%lld puntos"
1699 }
1700 },
1701 "fr": {
1702 "stringUnit": {
1703 "state": "translated",
1704 "value": "%lld points"
1705 }
1706 },
1707 "ja": {
1708 "stringUnit": {
1709 "state": "translated",
1710 "value": "%lldポイント"
1711 }
1712 },
1713 "pt-BR": {
1714 "stringUnit": {
1715 "state": "translated",
1716 "value": "%lld pontos"
1717 }
1718 }
1719 }
1720 },
1687 "%lld selected": { 1721 "%lld selected": {
1688 "localizations": { 1722 "localizations": {
1689 "de": { 1723 "de": {
@@ -25564,6 +25598,40 @@
25564 } 25598 }
25565 } 25599 }
25566 }, 25600 },
25601 "Outline width": {
25602 "localizations": {
25603 "de": {
25604 "stringUnit": {
25605 "state": "translated",
25606 "value": "Breite der Gliederung"
25607 }
25608 },
25609 "es": {
25610 "stringUnit": {
25611 "state": "translated",
25612 "value": "Ancho del esquema"
25613 }
25614 },
25615 "fr": {
25616 "stringUnit": {
25617 "state": "translated",
25618 "value": "Largeur de la structure"
25619 }
25620 },
25621 "ja": {
25622 "stringUnit": {
25623 "state": "translated",
25624 "value": "アウトラインの幅"
25625 }
25626 },
25627 "pt-BR": {
25628 "stringUnit": {
25629 "state": "translated",
25630 "value": "Largura da estrutura"
25631 }
25632 }
25633 }
25634 },
25567 "Overdue": { 25635 "Overdue": {
25568 "localizations": { 25636 "localizations": {
25569 "de": { 25637 "de": {
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form