Mac: one accessibility element over a cell being edited; windowing noted in the spec
Review #72 delta 2, finding 4. The floating editor sat over the cell's own button, so VoiceOver found two elements at one spot. The cell hides itself from accessibility while its editor is open, through a small modifier so opening an editor re-runs that modifier per cell and never a cell's body (the first-key measurement is unchanged). The spec now says that the grid builds only the cells in view, so cells, rows and columns off screen are not in the accessibility tree until scrolled to. Not tested in the test host: SwiftUI builds no accessibility tree there without an assistive client (accessibilityChildren is empty), so this is by reading only; worth a VoiceOver pass in review.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 files changed,
+23
−2
docs/superpowers/specs/2026-08-30-sheets-design.md+8 −1native/apple/Sources/SheetsKit/SheetCell.swift+14 −0native/apple/Sources/SheetsKit/SheetGrid.swift+1 −1
diff --git a/docs/superpowers/specs/2026-08-30-sheets-design.md b/docs/superpowers/specs/2026-08-30-sheets-design.md| index 6f5d16e..3895c50 100644 |
| --- a/docs/superpowers/specs/2026-08-30-sheets-design.md |
| +++ b/docs/superpowers/specs/2026-08-30-sheets-design.md |
| @@ -369,7 +369,14 @@ nothing else; one the server turns out to hold is cleared, and Revert |
| reads the server back. While anything is on its way the status reads |
| Saving…, never Saved. An ended session is not a refusal: the queue waits |
| for the session to be renewed and sends again. No edit outlives the sheet |
| -it was made on. These edits live in memory: they do not survive a quit or |
| +it was made on. |
| + |
| +**The native grid builds only the cells in view.** Columns and rows are |
| +windowed from exact widths and heights (a spacer stands in for the rest), |
| +so a cell scrolled out of view, and its row and column headers, are not in |
| +the accessibility tree until they are scrolled back; VoiceOver reads what |
| +is on screen and the formula bar and name box reach any cell. While a |
| +cell's editor is open, the editor is the only element over that cell. These edits live in memory: they do not survive a quit or |
| crash while unsent (§14). |
| **The SSE transport check is a streamed 200**, not a 101. SSE is |
diff --git a/native/apple/Sources/SheetsKit/SheetCell.swift b/native/apple/Sources/SheetsKit/SheetCell.swift| index 8e3a88b..58f4afd 100644 |
| --- a/native/apple/Sources/SheetsKit/SheetCell.swift |
| +++ b/native/apple/Sources/SheetsKit/SheetCell.swift |
| @@ -7,6 +7,8 @@ struct SheetCell: View { |
| var beginEditing: () -> Void = {} |
| var columnWidth: Double? = nil |
| var rowHeight: Double? = nil |
| + /// While this cell's editor is open, the editor is the one element here. |
| + var editState: SheetEditingState? = nil |
| @Environment(\.colorScheme) private var scheme |
| private func width(_ col: Int) -> Double { columnWidth ?? model.sizes.cols?[String(col)] ?? 110 } |
| private func height(_ row: Int) -> Double { rowHeight ?? model.sizes.rows?[String(row)] ?? 32 } |
| @@ -40,6 +42,7 @@ struct SheetCell: View { |
| .accessibilityLabel("\(point.ref), \(cell?.display ?? "Empty")") |
| .accessibilityValue(failed ? sheetsMacString("Not saved") : style?.lc == true ? "Imported colours have low contrast" : "") |
| .accessibilityAddTraits(model.selection.contains(point) ? .isSelected : []) |
| + .modifier(HiddenWhileEditing(state: editState, point: point)) |
| } |
| private func fill(_ style: CellStyle?) -> Color { cellFill(style, scheme: scheme) } |
| private func ink(_ style: CellStyle?) -> Color { |
| @@ -49,6 +52,17 @@ struct SheetCell: View { |
| } |
| } |
| +/// Hides a cell from accessibility while its editor floats over it, so |
| +/// VoiceOver finds one element there, not two. A modifier, so that opening an |
| +/// editor re-runs this small body for each cell and never the cell's own. |
| +private struct HiddenWhileEditing: ViewModifier { |
| + let state: SheetEditingState? |
| + let point: Coordinate |
| + func body(content: Content) -> some View { |
| + content.accessibilityHidden(state?.cell == point) |
| + } |
| +} |
| + |
| /// Retry and Revert on a cell whose edit was not saved. Only such a cell |
| /// carries a context menu and a tooltip, so the rest of the grid stays light. |
| private struct NotSavedActions: ViewModifier { |
diff --git a/native/apple/Sources/SheetsKit/SheetGrid.swift b/native/apple/Sources/SheetsKit/SheetGrid.swift| index 35a7c2c..d26fb49 100644 |
| --- a/native/apple/Sources/SheetsKit/SheetGrid.swift |
| +++ b/native/apple/Sources/SheetsKit/SheetGrid.swift |
| @@ -430,7 +430,7 @@ struct SheetGridContent: View, Equatable { |
| model: model, point: point, |
| select: { actions.select(point) }, |
| beginEditing: { actions.edit(point) }, |
| - columnWidth: m.width(col), rowHeight: m.height(row)) |
| + columnWidth: m.width(col), rowHeight: m.height(row), editState: editState) |
| } |
| #if os(macOS) |
| private func resizeHandle(axis: String, index: Int) -> some View { |