Skip to content

Add accessibility labels to sidebar navigation items - #5785

Closed
beastoin wants to merge 1 commit into
mainfrom
fix/desktop-sidebar-accessibility
Closed

beastoin wants to merge 1 commit into
mainfrom
fix/desktop-sidebar-accessibility

Conversation

@beastoin

Copy link
Copy Markdown
Collaborator

Summary

  • Added accessibilityLabel, accessibilityAddTraits(.isButton), and accessibilityIdentifier to all three sidebar navigation view components: NavItemView, NavItemWithStatusView, and BottomNavItemView
  • Identifiers follow the pattern sidebar_dashboard, sidebar_chat, sidebar_memories, etc.
  • Enables VoiceOver navigation and programmatic UI testing via agent-swift (find key sidebar_dashboard click)

Test plan

  • Build compiles (verified on Mac Mini with xcrun swift build)
  • agent-swift find key sidebar_dashboard returns the Dashboard nav item
  • VoiceOver can read sidebar item labels when focused

Fixes friction #8 from #5784.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 [email protected]

NavItemView, NavItemWithStatusView, and BottomNavItemView now expose
accessibilityLabel, accessibilityAddTraits(.isButton), and
accessibilityIdentifier to the macOS Accessibility API. This enables
VoiceOver navigation and agent-swift automated testing via
`find key sidebar_dashboard click`.

Fixes friction #8 from Issue #5784.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@greptile-apps

greptile-apps Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds VoiceOver and programmatic UI testing support to the three sidebar navigation components (NavItemView, NavItemWithStatusView, BottomNavItemView) by attaching .accessibilityLabel, .accessibilityAddTraits(.isButton), and .accessibilityIdentifier modifiers. The identifier scheme (sidebar_<label_lowercased>) provides a stable, predictable handle for agent-swift and UI test automation.

Key changes:

  • NavItemView: label and button trait added; identifier derived from label
  • NavItemWithStatusView: accessibility label includes live on/off state (e.g. "Rewind (On)"); identifier uses bare label for stability
  • BottomNavItemView: same pattern as NavItemView

Issues found:

  • In NavItemView, .accessibilityAddTraits(.isButton) is applied unconditionally even when isLocked = true, at which point the tap gesture is silently swallowed. VoiceOver users will be told the item is an interactive button but activating it will produce no response. The trait should be gated on !isLocked and a "Locked" hint should be provided when locked.

Confidence Score: 4/5

  • Safe to merge with one accessibility correctness concern for locked nav items.
  • The change is minimal and additive (3 lines per view struct). The only real issue is that locked NavItemView items incorrectly retain .isButton trait despite being non-interactive, which misleads VoiceOver users. All other modifiers are correctly applied and the identifier pattern is clean for the current set of labels.
  • desktop/Desktop/Sources/MainWindow/SidebarView.swift — specifically the NavItemView locked-state accessibility handling around lines 1296–1298.

Important Files Changed

Filename Overview
desktop/Desktop/Sources/MainWindow/SidebarView.swift Adds accessibility labels, button traits, and identifiers to NavItemView, NavItemWithStatusView, and BottomNavItemView. Minor issue: locked NavItemView items are still annotated with .isButton trait despite being non-interactive.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[SidebarView] --> B[NavItemView]
    A --> C[NavItemWithStatusView]
    A --> D[BottomNavItemView]

    B --> B1[".accessibilityLabel(label)"]
    B --> B2[".accessibilityAddTraits(.isButton)"]
    B --> B3[".accessibilityIdentifier('sidebar_<label>')"]
    B2 --> B4{"isLocked?"}
    B4 -- "true (no interaction)" --> B5["⚠️ Still announces as button"]
    B4 -- "false" --> B6["✅ Correct button behavior"]

    C --> C1[".accessibilityLabel('label (On/Off)')"]
    C --> C2[".accessibilityAddTraits(.isButton)"]
    C --> C3[".accessibilityIdentifier('sidebar_<label>')"]

    D --> D1[".accessibilityLabel(label)"]
    D --> D2[".accessibilityAddTraits(.isButton)"]
    D --> D3[".accessibilityIdentifier('sidebar_<label>')"]
Loading

Last reviewed commit: "Add accessibility la..."

Comment on lines +1297 to +1298
.accessibilityAddTraits(.isButton)
.accessibilityIdentifier("sidebar_\(label.lowercased().replacingOccurrences(of: " ", with: "_"))")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Locked items incorrectly announced as buttons

When isLocked is true, the .onTapGesture silently does nothing (guard !isLocked else { return }), but .accessibilityAddTraits(.isButton) is unconditionally applied. VoiceOver users will hear the item announced as an interactive button, try to activate it, and receive no feedback — making the UI feel broken or unresponsive to them.

The trait should be conditional on the locked state, and a hint should communicate the locked status:

Suggested change
.accessibilityAddTraits(.isButton)
.accessibilityIdentifier("sidebar_\(label.lowercased().replacingOccurrences(of: " ", with: "_"))")
.accessibilityAddTraits(isLocked ? [] : .isButton)
.accessibilityHint(isLocked ? "Locked" : "")
.accessibilityIdentifier("sidebar_\(label.lowercased().replacingOccurrences(of: " ", with: "_"))")

@github-actions

Copy link
Copy Markdown
Contributor

Hey @beastoin 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our roadmap and vision

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community! 💜

@undivisible
undivisible deleted the fix/desktop-sidebar-accessibility branch August 20, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant