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.

Let VoiceOver finish what it is saying before a list says what it found

Țugui Dragoșbe3d796e370b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4f4a3b2e..ee2a5fd4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -762,6 +762,8 @@ its changes the way [Keep a Changelog](https://keepachangelog.com/) suggests.
#### Every page
+- What VoiceOver hears as a list is read again waits for what it is saying: it cut off "Moved 1 item to the Trash"
+ within a moment, and on Background Items an action's own scan no longer talks over the state it left.
- On macOS 27, Uninstall with Peel in Finder's menu shows its mark in the color of the menu's text, where it was black on a
dark menu.
- On macOS 27, a search field keeps the keyboard when the rows it filters come and go, so the next letter no longer
diff --git a/Peel/Model/BackgroundItemLibrary.swift b/Peel/Model/BackgroundItemLibrary.swift
index 1d45a5df..3bcebbff 100644
--- a/Peel/Model/BackgroundItemLibrary.swift
+++ b/Peel/Model/BackgroundItemLibrary.swift
@@ -13,6 +13,8 @@ final class BackgroundItemLibrary {
/// The scan this page runs, which a newer one or the Stop button ends.
let scanRun = ScanRun()
var isScanning: Bool { scanRun.isRunning }
+ /// Whether a scan runs that VoiceOver is told of. An action says how it went itself, and its own scan follows.
+ var isScanningAsAsked: Bool { isScanning && runningActionItemIDs.isEmpty }
/// Counts the scans that finished, so an item's page asks macOS about it again with each.
private(set) var scans = 0
/// The items with an action in progress. Each is tracked on its own, so one row's action ending never
diff --git a/Peel/Views/BackgroundItems/BackgroundItemList.swift b/Peel/Views/BackgroundItems/BackgroundItemList.swift
index 786d3489..431d63d6 100644
--- a/Peel/Views/BackgroundItems/BackgroundItemList.swift
+++ b/Peel/Views/BackgroundItems/BackgroundItemList.swift
@@ -49,7 +49,7 @@ struct BackgroundItemList: View {
.fadesInColumn(whenRowsChange: backgroundItems.items?.map(\.id))
.navigationTitle(Text(Tool.backgroundItems.title))
.announcesScan(
- backgroundItems.isScanning,
+ backgroundItems.isScanningAsAsked,
found: announcement,
couldNotLook: couldNotLook,
wasStopped: backgroundItems.scanRun.wasStopped
diff --git a/Peel/Views/ToolSummaries.swift b/Peel/Views/ToolSummaries.swift
index fa07e948..0899e1db 100644
--- a/Peel/Views/ToolSummaries.swift
+++ b/Peel/Views/ToolSummaries.swift
@@ -215,10 +215,21 @@ extension RemovalHistoryStore {
}
}
+extension AttributedString {
+ /// These words as an announcement VoiceOver queues after what it is saying. At the default priority it would cut
+ /// that off.
+ var waitingForOtherSpeech: AttributedString {
+ var words = self
+ words.accessibilitySpeechAnnouncementPriority = .low
+ return words
+ }
+}
+
extension View {
/// Tells VoiceOver how a scan ended, since the list fills in silently: what it found, that it was stopped, or,
/// when it found nothing to tell, `couldNotLook`, the page's own words for why, in place of "Nothing found.". The
- /// summary is worked out only then, so the page does not depend on everything it reads.
+ /// summary is worked out only then, so the page does not depend on everything it reads. It waits for what is being
+ /// said, since a scan often ends right after the action that caused it says how it went.
func announcesScan(
_ isScanning: Bool,
found summary: @autoclosure @escaping () -> AttributedString?,
@@ -230,7 +241,7 @@ extension View {
let nothing = couldNotLook.map { AttributedString(localized: $0) }
?? AttributedString(localized: "Nothing found.")
let words = wasStopped ? AttributedString(localized: "Scan stopped.") : summary() ?? nothing
- AccessibilityNotification.Announcement(words).post()
+ AccessibilityNotification.Announcement(words.waitingForOtherSpeech).post()
}
}
}
diff --git a/PeelTests/BackgroundItemAnnouncementTests.swift b/PeelTests/BackgroundItemAnnouncementTests.swift
index d7c7d710..a08e85bc 100644
--- a/PeelTests/BackgroundItemAnnouncementTests.swift
+++ b/PeelTests/BackgroundItemAnnouncementTests.swift
@@ -1,3 +1,4 @@
+import Accessibility
import Foundation
@testable import Peel
@testable import PeelCore
@@ -23,6 +24,31 @@ struct BackgroundItemAnnouncementTests {
#expect(gone == nil)
}
+ @Test func anActionsOwnScanIsToldToNobody() async {
+ final class Reads {
+ var shown: [Bool] = []
+ var library: BackgroundItemLibrary?
+ }
+ let reads = Reads()
+ let listed = job(.loaded)
+ let library = BackgroundItemLibrary { _, _ in
+ reads.shown.append(reads.library?.isScanningAsAsked == true)
+ return BackgroundItems.Scan(items: [listed])
+ }
+ reads.library = library
+
+ await library.refresh(installedApps: [])
+ await library.perform(.stop, on: listed)
+
+ #expect(reads.shown == [true, false])
+ }
+
+ @Test func aScansEndWaitsForWhatVoiceOverIsSaying() {
+ let words = AttributedString("Found").waitingForOtherSpeech
+
+ #expect(words.accessibilitySpeechAnnouncementPriority == .low)
+ }
+
private func words(_ state: LocalizedStringResource) -> String {
String(localized: "\("org.example.agent"): \(String(localized: state))")
}