diff options
| author | Christian Cleberg <[email protected]> | 2026-07-21 20:00:46 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-07-21 20:38:45 -0500 |
| commit | dc479a3ba0d27fe86509d0eb2d27b01132c2b37f (patch) | |
| tree | 4cc69b5fff2895e2ef794354fcdf89d56fa80e27 /DomainDig/BatchResultsView.swift | |
| parent | e2da09fec3d3d52ac6108b9256b2419405f76dd3 (diff) | |
| download | domain-dig-dc479a3ba0d27fe86509d0eb2d27b01132c2b37f.tar.gz domain-dig-dc479a3ba0d27fe86509d0eb2d27b01132c2b37f.tar.bz2 domain-dig-dc479a3ba0d27fe86509d0eb2d27b01132c2b37f.zip | |
feat(a11y): VoiceOver labels, dense-row rotor content, announcements (#21 phase 4)
The audit count is unchanged at 11 dark, and that is the expected
result: performAccessibilityAudit validates descriptions, traits,
contrast, hit regions, and clipping, but exercises none of VoiceOver's
speech, the More Content rotor, custom-content ordering, or
announcements — which is the entire substance of this phase. It is
verified by construction and stays green with no regressions; the
manual VoiceOver pass is Phase 6.
Icon-only controls (~14) get accessibilityLabel, obeying label-in-name:
where a control has visible text the label keeps it, so Voice Control
still works. The pin and bookmark toggles gain accessibilityValue and
.isSelected; the audit and workflow checkboxes gain .isSelected and a
hint. Decorative icons split out of Labels are hidden.
AppStatusBadgeView now reads as one word ("Critical"), not "icon,
Critical", via children: .ignore + label. SectionTitleView and
CollapsibleSectionView headers get the .isHeader trait for rotor
navigation; the collapsible header also exposes expanded/collapsed as a
value with a hint. The header deliberately does NOT use children:
.combine — its trailing() closure can hold Track/Pin controls, and
combining would swallow them.
Dense rows use combine-for-summary, custom-content-for-detail.
BatchResultRowView (8 elements) and WatchlistRowView (up to 9) become a
single element — domain as label, status as value — with risk, IP,
timestamp, source, certificate, and monitoring on the More Content
rotor, risk and certificate at .high importance. Reading all of it
inline would make a long sweep unnavigable. The custom-content chains
live in ViewModifiers because inlining six of them plus the layout broke
the type-checker. The shorter 3-4 element portfolio rows are left to
NavigationLink's automatic combine, per WWDC21-10121.
Technical strings get a speechStyle field on InfoRowViewData:
.technical applies speechAlwaysIncludesPunctuation and
accessibilityTextContentType(.sourceCode), set on DNS record values and
cipher suites so load-bearing punctuation is not swallowed.
Completion announcements: the sweep posts from the view model; the
single lookup posts from an onChange in the view, since resultsLoaded is
derived from many loading flags and has no single view-model moment.
Widget: each domain row was a silent 8pt status dot plus a bare "12d"
countdown. Rows now read as one phrase ("example.com, critical,
certificate expires in 12 days"); the count pills are labelled.
Not verifiable by the suite: the dense rows and the widget never render
in the audit (no tracked domains or batch results in the test
simulator), same limit as the deferred Phase 3 row reflow. Documented in
Docs/ACCESSIBILITY.md.
Diffstat (limited to 'DomainDig/BatchResultsView.swift')
| -rw-r--r-- | DomainDig/BatchResultsView.swift | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/DomainDig/BatchResultsView.swift b/DomainDig/BatchResultsView.swift index 4b4f6fd..aeae48f 100644 --- a/DomainDig/BatchResultsView.swift +++ b/DomainDig/BatchResultsView.swift @@ -116,6 +116,39 @@ struct BatchResultRowView: View { .frame(maxWidth: .infinity, alignment: .leading) .padding(.vertical, 4) .frame(minHeight: appDensity.metrics.rowMinHeight + 12, alignment: .topLeading) + // One VoiceOver stop per row: domain as the label, status as the value, + // everything else on the More Content rotor. Reading all eight text + // elements inline would make a 200-domain sweep unnavigable. `.high` + // importance is spoken without the rotor; the rest waits for a swipe. + // Extracted to a modifier — inlined, the chain broke the type-checker. + .modifier(BatchRowAccessibility( + domain: result.domain, + status: "\(quickStatusBadge.title), \(availabilityText)", + risk: riskDescription, + ip: result.primaryIP ?? "none", + checked: result.timestamp.formatted(date: .abbreviated, time: .shortened), + source: result.resultSource.label, + changeLabel: changeContentLabel, + changeValue: changeContentValue + )) + } + + private var changeContentLabel: String { + result.changeClassification != nil ? "Impact" : "Status" + } + + private var changeContentValue: String { + if let change = result.changeClassification { + return change.title + } + return result.errorMessage ?? result.summaryMessage ?? quickStatusBadge.title + } + + private var riskDescription: String { + if let score = result.riskScore, let level = result.riskLevel { + return "\(score), \(level.title)" + } + return "not scored" } private var availabilityText: String { @@ -164,3 +197,30 @@ struct BatchResultRowView: View { } } } + +/// Row-level VoiceOver treatment for a batch result: a single element whose +/// label is the domain and whose value is the status, with the remaining fields +/// on the More Content rotor. Extracted from the row body because inlining the +/// full modifier chain broke Swift's type-checker. +private struct BatchRowAccessibility: ViewModifier { + let domain: String + let status: String + let risk: String + let ip: String + let checked: String + let source: String + let changeLabel: String + let changeValue: String + + func body(content: Content) -> some View { + content + .accessibilityElement(children: .ignore) + .accessibilityLabel(domain) + .accessibilityValue(status) + .accessibilityCustomContent("Risk", risk, importance: .high) + .accessibilityCustomContent("IP address", ip) + .accessibilityCustomContent("Checked", checked) + .accessibilityCustomContent("Source", source) + .accessibilityCustomContent(LocalizedStringResource(stringLiteral: changeLabel), changeValue) + } +} |
