Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Tell VoiceOver a notice's kind whichever symbol it draws

Țugui Dragoșdeb001ed3973
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DecorativeSymbolTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DecorativeSymbolTests.swift
index c1f453f7..0d76d5d2 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DecorativeSymbolTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DecorativeSymbolTests.swift
@@ -34,11 +34,12 @@ struct DecorativeSymbolTests {
#expect(found.isEmpty, "VoiceOver would say macOS's word for these symbols: \(found)")
}
- @Test func aNoticesOwnSymbolIsDecoration() throws {
+ @Test func aNoticeTellsVoiceOverItsKindWhicheverSymbolItDraws() throws {
let text = try String(
contentsOf: LineLengthTests.repository.appending(path: "Peel/Views/Notice.swift"), encoding: .utf8
)
- #expect(text.contains(".accessibilityHidden(systemImage != nil)"))
+ #expect(text.contains(".accessibilityRepresentation { Image(systemName: kindSymbol) }"))
+ #expect(!text.contains(".accessibilityHidden("))
}
@Test func aMissingAppsStandInTellsVoiceOverItIsNotInstalled() throws {
diff --git a/Peel/Views/Notice.swift b/Peel/Views/Notice.swift
index d8b9dc83..dda1f351 100644
--- a/Peel/Views/Notice.swift
+++ b/Peel/Views/Notice.swift
@@ -107,12 +107,13 @@ struct Notice<Actions: View>: View {
.foregroundStyle(isQuiet ? Color.secondary : .white)
)
} else {
- Image(systemName: systemImage ?? (kind == .note ? "info.circle.fill" : "exclamationmark.triangle.fill"))
+ let kindSymbol = kind == .note ? "info.circle.fill" : "exclamationmark.triangle.fill"
+ Image(systemName: systemImage ?? kindSymbol)
.font(.system(size: 16))
.foregroundStyle(tint)
.frame(width: 26)
- // The kind's own symbol tells VoiceOver Info or Warning; one a page chooses only decorates.
- .accessibilityHidden(systemImage != nil)
+ // VoiceOver hears the kind's own symbol, Info or Warning, whichever symbol is drawn.
+ .accessibilityRepresentation { Image(systemName: kindSymbol) }
}
}
}