oficina / docs Public

Docs native S2a: callouts keep clear of the floating inspector

Below about 1,136pt the callouts (560pt, centred on the window) ran under
the inspector (Fable on #169, finding 4). They are now centred in the desk
beside it: 16pt from the leading edge and the inspector's reserve (276pt)
from the trailing one while it shows. New snapshot screen
window-callout-narrow: a writer's callout with Format open at 1000pt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev b1272b8f4a7433c704789f679239afb49c1e9560 parent cc7ca0b
4 files changed, +13 −2
  • native/apple/Sources/DocsKit/DocsDocumentHeader.swift +6 −0
  • native/apple/Sources/DocsKit/DocsWorkspace.swift +1 −1
  • native/apple/Tests/DocsSnapshots/EditorSnapshots.swift +1 −0
  • native/apple/Tests/DocsSnapshots/WindowSnapshots.swift +5 −1
diff --git a/native/apple/Sources/DocsKit/DocsDocumentHeader.swift b/native/apple/Sources/DocsKit/DocsDocumentHeader.swift
index 2ddf90b..acaeed3 100644
--- a/native/apple/Sources/DocsKit/DocsDocumentHeader.swift
+++ b/native/apple/Sources/DocsKit/DocsDocumentHeader.swift
@@ -197,6 +197,9 @@ struct DocsPillStyle: ButtonStyle {
/// still asks about unsent changes. nil uses the window this view is in.
var close: (() -> Void)? = nil
@State private var closer = DocsWindowCloser()
+ /// The floating inspector shows: the callouts keep clear of it, centred
+ /// in the desk beside it rather than under it.
+ var inspectorShown = false
/// The account flow, as Settings' Sign in… opens it (the home window).
var signIn: () -> Void = {}
var body: some View {
@@ -227,6 +230,9 @@ struct DocsPillStyle: ButtonStyle {
}
.padding(.top, DocsSpacing.sp3)
.frame(maxWidth: 560)
+ .frame(maxWidth: .infinity)
+ .padding(.leading, DocsDeskLayout.padding)
+ .padding(.trailing, inspectorShown ? DocsDeskLayout.reserve : DocsDeskLayout.padding)
.background { DocsWindowReader(closer: closer).frame(width: 0, height: 0) }
}
private func callout<Actions: View>(_ text: Text, negative: Bool, @ViewBuilder actions: () -> Actions) -> some View {
diff --git a/native/apple/Sources/DocsKit/DocsWorkspace.swift b/native/apple/Sources/DocsKit/DocsWorkspace.swift
index 8aaa430..fc8f3f1 100644
--- a/native/apple/Sources/DocsKit/DocsWorkspace.swift
+++ b/native/apple/Sources/DocsKit/DocsWorkspace.swift
@@ -310,7 +310,7 @@ import SwiftUI
// One title (spec §1): the window's title stays the document's,
// for the Window menu, tabs and VoiceOver, but the system does
// not draw it; Docs' title area does, with the subtitle.
- .overlay(alignment: .top) { DocsDocumentCallouts(model: model, discard: { discarding = true }, signIn: { openWindow(id: "home") }) }
+ .overlay(alignment: .top) { DocsDocumentCallouts(model: model, discard: { discarding = true }, inspectorShown: showsInspector, signIn: { openWindow(id: "home") }) }
.toolbar(removing: .title)
.toolbar {
ToolbarItem(placement: .navigation) {
diff --git a/native/apple/Tests/DocsSnapshots/EditorSnapshots.swift b/native/apple/Tests/DocsSnapshots/EditorSnapshots.swift
index 6173643..0997ba3 100644
--- a/native/apple/Tests/DocsSnapshots/EditorSnapshots.swift
+++ b/native/apple/Tests/DocsSnapshots/EditorSnapshots.swift
@@ -210,6 +210,7 @@ enum EditorScript: Sendable {
try await settle(model, account)
// A document deleted or unshared while open (spec §6 row 1).
if chrome?.unavailable == true { model.unavailable = true; model.inputPaused = true }
+ if let key = chrome?.errorKey { model.errorKey = key }
try await layOut()
await Task.yield()
ready = true
diff --git a/native/apple/Tests/DocsSnapshots/WindowSnapshots.swift b/native/apple/Tests/DocsSnapshots/WindowSnapshots.swift
index b2b3a84..80a25ee 100644
--- a/native/apple/Tests/DocsSnapshots/WindowSnapshots.swift
+++ b/native/apple/Tests/DocsSnapshots/WindowSnapshots.swift
@@ -11,6 +11,8 @@ struct WindowChrome: Sendable {
var inspector: Bool
var reader = false
var unavailable = false
+ /// A writer's callout (today's errorKey), shown beside the inspector.
+ var errorKey: String? = nil
/// The interface language, nil for English.
var language: String? = nil
var rightToLeft: Bool { language == "ar" }
@@ -55,6 +57,8 @@ final class DocsWindowSnapshots: XCTestCase {
window("window-format-open-narrow", .init(inspector: true), size: narrow),
window("window-reader", .init(inspector: true, reader: true)),
window("window-unavailable", .init(inspector: true, unavailable: true)),
+ // A callout beside the inspector at 1000pt: it keeps clear of it.
+ window("window-callout-narrow", .init(inspector: true, errorKey: "docs.editor.status.retrying"), size: narrow),
window("window-format-open-ar", .init(inspector: true, language: "ar"), fixture: .arabic),
window("window-format-open-ru", .init(inspector: true, language: "ru"), fixture: .russian),
SnapshotScreen("subtitles", mac: .width(420), iphone: nil) { SubtitleRows(language: "en") },
@@ -108,7 +112,7 @@ final class DocsWindowSnapshots: XCTestCase {
.padding(.trailing, DocsDeskLayout.inspectorInset)
}
}
- .overlay(alignment: .top) { DocsDocumentCallouts(model: model, discard: {}, close: {}) }
+ .overlay(alignment: .top) { DocsDocumentCallouts(model: model, discard: {}, close: {}, inspectorShown: chrome.inspectorSide != nil) }
}
.onAppear { open = chrome.inspector }
.environment(\.locale, Locale(identifier: chrome.language ?? "en"))