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 {
1818 @State private var sortOrder = [KeyPathComparator(\BoardRow.todoOrder), KeyPathComparator(\BoardRow.title)]
1919 @State private var message: String?
2020 @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
2124 @AppStorage("boardKanban") private var kanban = false
2225 @AppStorage("boardMatch") private var match = ""
2326 @AppStorage("boardColumns") private var columnText = "EFFORT"
@@ -131,15 +134,54 @@ struct BoardView: View {
131134 // MARK: - Kanban
132135
133136 private var board: some View {
134 ScrollView(.horizontal) {
135 HStack(alignment: .top, spacing: 12) {
136 ForEach(keywords, id: \.self) { keyword in
137 column(keyword)
137 ScrollViewReader { proxy in
138 ScrollView(.horizontal) {
139 HStack(alignment: .top, spacing: 12) {
140 ForEach(keywords, id: \.self) { keyword in
141 column(keyword)
142 }
138143 }
144 .padding(12)
145 }
146 .onChange(of: current) {
147 if let current { proxy.scrollTo(current) }
139148 }
140 .padding(12)
141149 }
142150 .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
143185 }
144186
145187 private func column(_ keyword: String) -> some View {
@@ -153,10 +195,15 @@ struct BoardView: View {
153195 VStack(alignment: .leading, spacing: 6) {
154196 ForEach(cards) { entry in
155197 card(entry)
198 .id(entry.id)
156199 .draggable(entry.id)
157200 .onTapGesture(count: 2) { jump(entry) }
201 .simultaneousGesture(TapGesture().onEnded {
202 current = entry.id
203 boardFocused = true
204 })
158205 .accessibilityElement(children: .combine)
159 .accessibilityAddTraits(.isButton)
206 .accessibilityAddTraits(current == entry.id ? [.isButton, .isSelected] : .isButton)
160207 .accessibilityAction { jump(entry) }
161208 .accessibilityActions {
162209 // Dragging between columns, for VoiceOver.
@@ -181,7 +228,8 @@ struct BoardView: View {
181228 }
182229
183230 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) {
185233 Text((entry.priority.map { "[#\($0)] " } ?? "") + entry.title).lineLimit(3)
186234 HStack(spacing: 6) {
187235 Text(entry.category).font(.caption).foregroundStyle(.secondary)
@@ -198,6 +246,9 @@ struct BoardView: View {
198246 .padding(8)
199247 .frame(maxWidth: .infinity, alignment: .leading)
200248 .background(RoundedRectangle(cornerRadius: 6).fill(Color(nsColor: .controlBackgroundColor)))
249 .overlay {
250 if selected { RoundedRectangle(cornerRadius: 6).strokeBorder(theme.color("accent") ?? .accentColor, lineWidth: 2) }
251 }
201252 }
202253
203254 // MARK: - Editing
Sources/Orgstar/BufferTabs.swift +15 −7 · view
@@ -22,7 +22,13 @@ struct PaneDivider: View {
2222 start = base
2323 width = min(max(base + drag.translation.width, range.lowerBound), range.upperBound)
2424 }.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 }
2632 }
2733}
2834
@@ -50,25 +56,27 @@ struct BufferTabs: View {
5056
5157 private func tab(_ path: String) -> some View {
5258 let current = path == pane.path
53 return HStack(spacing: 6) {
54 Text(session.bufferName(path))
59 return HStack(spacing: 2) {
60 Button(session.bufferName(path)) { session.open(path, in: pane) }
61 .buttonStyle(.plain)
5562 .lineLimit(1)
5663 .foregroundStyle(current ? .primary : .secondary)
57 .accessibilityAddTraits(current ? [.isButton, .isSelected] : .isButton)
58 .accessibilityAction { session.open(path, in: pane) }
64 .accessibilityAddTraits(current ? .isSelected : [])
5965 Button {
6066 close(path)
6167 } label: {
6268 Image(systemName: session.dirtyPaths.contains(path) ? "circle.fill" : "xmark")
6369 .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())
6572 }
6673 .buttonStyle(.borderless)
6774 .help("Close")
6875 .accessibilityLabel("Close \(session.bufferName(path))" + (session.dirtyPaths.contains(path) ? ", unsaved" : ""))
6976 }
7077 .font(.callout)
71 .padding(.horizontal, 12)
78 .padding(.leading, 12)
79 .padding(.trailing, 6)
7280 .frame(maxHeight: .infinity)
7381 // A shape, not a color: a color background runs up under the toolbar.
7482 .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 {
1414 @AppStorage("inspectorClockSpan") private var span = Span.week
1515 @State private var columns: ColumnView.View?
1616 @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 }
1726
1827 enum Tab: String, CaseIterable {
1928 case columns = "Columns", clock = "Clock"
@@ -79,33 +88,22 @@ struct InspectorPane: View {
7988 .padding(.horizontal, 8)
8089 .padding(.bottom, 6)
8190 if let columns, !columns.rows.isEmpty {
82 ScrollView([.horizontal, .vertical]) {
83 Grid(alignment: .leading, horizontalSpacing: 10, verticalSpacing: 3) {
84 GridRow {
85 ForEach(columns.specs.indices, id: \.self) { i in
86 Text(columns.specs[i].title).bold().foregroundStyle(.secondary)
87 }
88 }
89 Divider()
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) }
91 // A table, so the arrow keys move through the rows; selecting one goes to it.
92 Table(columns.rows.map(ColumnRow.init), selection: $selectedRow) {
93 TableColumnForEach(columns.specs.indices, id: \.self) { i in
94 TableColumn(columns.specs[i].title) { (item: ColumnRow) in
95 let row = item.row
96 Text(columns.specs[i].property == "ITEM" ? String(repeating: "*", count: row.level) + " " + row.values[i] : row.values[i])
97 .lineLimit(1)
98 .fontWeight(row.start == heading ? .semibold : .regular)
10399 }
104100 }
105 .font(.system(.callout, design: .monospaced))
106 .padding(8)
107101 }
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 }
109107 } else {
110108 ContentUnavailableView("No entries", systemImage: "tablecells")
111109 }
@@ -122,7 +120,8 @@ struct InspectorPane: View {
122120 if clocked.isEmpty {
123121 ContentUnavailableView("No clocked time", systemImage: "clock")
124122 } else {
125 List {
123 // A selectable list, so the arrow keys move through the headings; selecting one goes to it.
124 List(selection: $selectedClock) {
126125 ForEach(clocked, id: \.start) { entry in
127126 HStack {
128127 Text(entry.heading.isEmpty ? String(localized: "(untitled)") : entry.heading).lineLimit(1)
@@ -130,11 +129,8 @@ struct InspectorPane: View {
130129 Text(ClockReport.hours(entry.minutes)).monospacedDigit()
131130 }
132131 .fontWeight(entry.start == heading ? .semibold : .regular)
133 .contentShape(Rectangle())
134 .onTapGesture { session.reveal(entry.start) }
135132 .accessibilityElement(children: .combine)
136 .accessibilityAddTraits(.isButton)
137 .accessibilityAction { session.reveal(entry.start) }
133 .tag(entry.start)
138134 }
139135 HStack {
140136 Text("Total").bold()
@@ -142,6 +138,10 @@ struct InspectorPane: View {
142138 Text(ClockReport.hours(clocked.reduce(0) { $0 + $1.minutes })).bold().monospacedDigit()
143139 }
144140 }
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 }
145145 }
146146 }
147147
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
4040
4141The 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]].
4242
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.
4444
4545* Folders
4646
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
395395
396396The 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.
397397
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".
399399
400400The 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=
706706View ▸ Show Columns and Clock opens an inspector beside the editor. Its Columns
707707tab shows the same table for the open file, kept current as you type. Choose File for
708708every 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
710711[[file:06-dates-and-clocking.org][Dates and clocking]].
711712
712713** 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
416416
417417** The inspector
418418
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.
420420
421421** The clock report window
422422
docs/manual/guide/07-agenda.org +2 · view
@@ -704,6 +704,8 @@ Columns: TODO, priority, title, tags, scheduled, deadline, your property columns
704704
705705Each 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.
706706
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
707709With 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.
708710
709711** On iOS
l10n/Localizable.xcstrings +68 · view
@@ -1684,6 +1684,40 @@
16841684 }
16851685 }
16861686 },
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 },
16871721 "%lld selected": {
16881722 "localizations": {
16891723 "de": {
@@ -25564,6 +25598,40 @@
2556425598 }
2556525599 }
2556625600 },
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 },
2556725635 "Overdue": {
2556825636 "localizations": {
2556925637 "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