diff --git a/.jules/palette.md b/.jules/palette.md index f2d658a..0269487 100644 --- a/.jules/palette.md +++ b/.jules/palette.md @@ -17,3 +17,6 @@ ## 2024-05-25 - Dynamic Labels and Disabled State Tooltips **Learning:** Users can feel confused when a primary button is disabled without explanation or when a long-running action lacks immediate inline text feedback on the button itself. **Action:** In SwiftUI, enhance button accessibility and UX by adding `.help()` tooltips to explain the required state when disabled, and using dynamic labels (e.g., 'Scanning...') to provide immediate feedback during async operations. +## 2024-06-13 - Accessibility for Collapsible Sections +**Learning:** Custom SwiftUI buttons functioning as DisclosureGroups (collapsible sections) rely on visual cues (like chevrons) and lack implicit state readout. They require explicit `.accessibilityValue` to announce their expanded/collapsed state to VoiceOver users. +**Action:** When building custom collapsible sections, always group the button contents and explicitly provide an `.accessibilityValue` based on the expanded state. diff --git a/Sources/Cacheout/Views/NodeModulesSection.swift b/Sources/Cacheout/Views/NodeModulesSection.swift index 9f0af4e..d6dbae0 100644 --- a/Sources/Cacheout/Views/NodeModulesSection.swift +++ b/Sources/Cacheout/Views/NodeModulesSection.swift @@ -58,6 +58,10 @@ struct NodeModulesSection: View { .contentShape(Rectangle()) } .buttonStyle(.plain) + .accessibilityElement(children: .combine) + .accessibilityAddTraits(.isButton) + .accessibilityValue(isExpanded ? "Expanded" : "Collapsed") + .accessibilityHint("Toggles the project node_modules section") if isExpanded && viewModel.isNodeModulesScanning { HStack {