fix(workspace): audit fixes — dedupe failure chip, width-guard mentor overlay, a11y, NSColor bridge (#87)
Reviewer fan-out (ponytail/security/general) synthesis: - one failure surface in focus (chip carries it; toolbar stays recessed) - draft '⌘S saves' cue in focus (drafts have no autosave) - mentor reveal honors the #17 width verdict - hidden overlay panels leave the accessibility tree - NSColor(DesignTokens.background) bridge replaces the twin constant - HoverZone width plumbing deleted, zoneWidth hoisted as the knob - single >=1100 threshold read in WorkspaceView
This commit is contained in:
1 parent
9c2926f027
commit
d07d41859a
6 files changed
+51
-48
No files matched your search
@@ -20,13 +20,14 @@ import SwiftUI
|
||||
struct HoverZone: NSViewRepresentable {
|
||||
enum Edge { case leading, trailing }
|
||||
|
||||
/// Calibration knob: edge sensor strip width (pt).
|
||||
static let zoneWidth: CGFloat = 14
|
||||
|
||||
var edge: Edge
|
||||
var width: CGFloat
|
||||
var onHover: @MainActor (Bool) -> Void
|
||||
|
||||
final class SensorView: NSView {
|
||||
var edge: Edge = .leading
|
||||
var zoneWidth: CGFloat = 14
|
||||
var onHover: ((Bool) -> Void)?
|
||||
|
||||
private var trackingArea: NSTrackingArea?
|
||||
@@ -36,9 +37,9 @@ struct HoverZone: NSViewRepresentable {
|
||||
if let trackingArea {
|
||||
removeTrackingArea(trackingArea)
|
||||
}
|
||||
let stripX = edge == .leading ? 0 : max(0, bounds.width - zoneWidth)
|
||||
let stripX = edge == .leading ? 0 : max(0, bounds.width - HoverZone.zoneWidth)
|
||||
let area = NSTrackingArea(
|
||||
rect: NSRect(x: stripX, y: 0, width: min(zoneWidth, bounds.width), height: bounds.height),
|
||||
rect: NSRect(x: stripX, y: 0, width: min(HoverZone.zoneWidth, bounds.width), height: bounds.height),
|
||||
options: [.mouseEnteredAndExited, .activeInActiveApp],
|
||||
owner: self,
|
||||
userInfo: nil,
|
||||
@@ -73,9 +74,7 @@ struct HoverZone: NSViewRepresentable {
|
||||
|
||||
private func configure(_ view: SensorView) {
|
||||
view.edge = edge
|
||||
view.zoneWidth = width
|
||||
view.onHover = onHover
|
||||
view.updateTrackingAreas()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,13 +99,14 @@ struct FocusOverlayPanel<Content: View>: View {
|
||||
|
||||
var body: some View {
|
||||
ZStack(alignment: edge == .leading ? .leading : .trailing) {
|
||||
HoverZone(edge: edge, width: 14) { hover($0) }
|
||||
HoverZone(edge: edge) { hover($0) }
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
content()
|
||||
.background(DesignTokens.surface)
|
||||
.shadow(color: .black.opacity(0.10), radius: 12, y: 0)
|
||||
.frame(maxHeight: .infinity)
|
||||
.allowsHitTesting(revealed)
|
||||
.accessibilityHidden(!revealed)
|
||||
.onHover { hover($0) }
|
||||
.opacity(revealed ? 1 : 0)
|
||||
.offset(x: revealed ? 0 : hiddenOffset)
|
||||
|
||||
Reference in new issue
Block a user