From 4c24be2b85be556b63531aacb86075999233566c Mon Sep 17 00:00:00 2001 From: Umputun Date: Sun, 9 Aug 2026 13:12:21 -0500 Subject: [PATCH] fix: highlight the palette row under the pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Palette rows have been full-width click targets since they were built, but nothing painted under the pointer — only the keyboard-selected row was tinted, so there was no way to tell what a click would run. The title-bar popover rows already highlight on hover via SessionPopoverRow, and README documents that behavior, so the palette was the one clickable list in the app with no pointer feedback. PaletteRow now carries its own hover state, keeping the diffing boundary the struct exists for. Hover paints a neutral wash instead of a weaker accent so it cannot be mistaken for a second selection when both are on screen; selection still wins on the row that has it, and hover stays purely visual — it does not move the keyboard cursor, which would thrash the theme palette's live preview. Fix #408 --- agterm/Views/Palette.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/agterm/Views/Palette.swift b/agterm/Views/Palette.swift index 2f3dabb91..0f5d46bae 100644 --- a/agterm/Views/Palette.swift +++ b/agterm/Views/Palette.swift @@ -335,6 +335,17 @@ private struct PaletteRow: View { let item: PaletteItem let isSelected: Bool let metrics: InterfaceMetrics + @State private var hovering = false + + /// A neutral wash rather than a weaker accent: hover and the accent-tinted selection can sit on different + /// rows at once, so the same hue at two strengths would read as a second selection. It also has to hold up + /// over both panel backings, `.regularMaterial` and the opaque Reduce Transparency one. + private static let hoverTint = Color.primary.opacity(0.04) + + private var rowTint: Color { + if isSelected { return Color.accentColor.opacity(0.25) } + return hovering ? Self.hoverTint : .clear + } var body: some View { HStack { @@ -370,8 +381,9 @@ private struct PaletteRow: View { .padding(.horizontal, metrics.scaled(12)) .padding(.vertical, metrics.scaled(6)) .frame(maxWidth: .infinity, alignment: .leading) - .background(isSelected ? Color.accentColor.opacity(0.25) : Color.clear) + .background(rowTint) .contentShape(Rectangle()) + .onHover { hovering = $0 } .accessibilityIdentifier("palette-item-\(item.id)") } }