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 and Voice Control press the Tweaks switches

Țugui Dragoș8727894987df
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 7b7c00b8..fba263c2 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -215,6 +215,10 @@ read in one sitting.
`.borderless`: one of another style changes the window's list of focusable views whenever a row scrolls in or out.
A row a `ForEach` repeats never hides its own separator and is never a `Toggle` itself; the `ForEach` hides the
separators. A row that stands alone, such as a header or a notice, may hide its own, which costs nothing.
+- **Every switch can be pressed without a pointer.** SwiftUI gives a switch whose label is hidden with
+ `labelsHidden()` no action an assistive technology can perform, so such a switch carries an
+ `accessibilityRepresentation`: a `Toggle` labeled with the row's title, which VoiceOver, Voice Control, and Switch
+ Control can press. AppKit's `NSAccessibilityCheckBox` protocol requires every checkbox and switch to answer a press.
- **The interface follows Liquid Glass.** The sticker album look belongs to Home, the menu bar panel, and About
only; every other screen reads as macOS (system type, `Form` and `Section`, native controls). Icons are SF
Symbols, and the logo comes only from `Logo/`, but for the face at the head of the sidebar, which draws the logo's
diff --git a/Peel/Views/Tweaks/TweakDetailView.swift b/Peel/Views/Tweaks/TweakDetailView.swift
index e9a55a6d..10ae7bcd 100644
--- a/Peel/Views/Tweaks/TweakDetailView.swift
+++ b/Peel/Views/Tweaks/TweakDetailView.swift
@@ -114,13 +114,16 @@ struct TweakRow: View {
private func control(_ state: TweakState) -> some View {
switch tweak.kind {
case .aSwitch, .aSwitchForThisAppAlone:
- Toggle(isOn: Binding(
+ let isOn = Binding(
get: { tweaks.isOn(tweak, state: state) },
set: { tweaks.set(tweak, on: $0) }
- )) { EmptyView() }
- .labelsHidden()
- .accessibilityLabel(Text(tweak.words.title))
- .disabled(state.isManaged)
+ )
+ Toggle(isOn: isOn) { EmptyView() }
+ .labelsHidden()
+ .accessibilityRepresentation {
+ Toggle(isOn: isOn) { Text(tweak.words.title) }
+ }
+ .disabled(state.isManaged)
case .folder:
// The folder row has no switch to turn off, so Put Back is how the user undoes Peel's change.
// It fades in and out, since it takes room in the row as it comes and goes.