Skip to content

🎨 Palette: Add dynamic context to list accessibility#70

Open
NSEvent wants to merge 2 commits into
mainfrom
palette-dynamic-accessibility-context-13112545269818779337
Open

🎨 Palette: Add dynamic context to list accessibility#70
NSEvent wants to merge 2 commits into
mainfrom
palette-dynamic-accessibility-context-13112545269818779337

Conversation

@NSEvent

@NSEvent NSEvent commented Jun 30, 2026

Copy link
Copy Markdown
Owner

🎨 Palette: Add dynamic context to list accessibility

💡 What:
Added dynamic, item-specific context to the .help() and .accessibilityLabel() modifiers on icon-only edit and delete buttons in various list views (ScriptListView, MacroListView, and ChordSequenceListViews).

🎯 Why:
When rendering repeated lists (using ForEach), providing static "Edit" or "Delete" labels for icon-only buttons makes the interface ambiguous for users relying on screen readers or pointer tooltips, as they lack context on which item the action targets. Dynamic context (e.g., "Edit [Macro Name]") disambiguates these actions and significantly improves accessibility.

Accessibility:

  • Improved screen reader context for list actions.
  • Improved tooltip clarity for pointer users.
  • Ensured graceful fallbacks for empty names (e.g., "Untitled Macro").

PR created automatically by Jules for task 13112545269818779337 started by @NSEvent

Summary by CodeRabbit

  • Accessibility Improvements
    • Added clearer help text and accessibility labels for icon-only actions across macro, chord, sequence, and script lists.
    • Action buttons now include the relevant item name, making edit/delete actions easier to understand with screen readers and tooltips.
    • Empty-state example buttons also gained item-specific accessibility metadata for better clarity.

Added dynamic, item-specific context to icon-only edit and delete buttons in SwiftUI repeated lists (`ScriptListView`, `MacroListView`, and `ChordSequenceListViews`) to disambiguate actions for screen readers and tooltip users. Updated `.Jules/palette.md` to document this learning.

Co-authored-by: NSEvent <44446865+NSEvent@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Icon-only action buttons (Edit, Delete) in MacroListView, ChordSequenceListViews, and ScriptListView have their .help() and .accessibilityLabel() strings updated from generic text to item-specific names with fallbacks. A new entry in .Jules/palette.md documents this pattern.

Contextual accessibility labels for list row buttons

Layer / File(s) Summary
Item-specific .help/.accessibilityLabel across all list views
XboxControllerMapper/.../Macros/MacroListView.swift, XboxControllerMapper/.../MainWindow/ChordSequenceListViews.swift, XboxControllerMapper/.../Scripts/ScriptListView.swift, .Jules/palette.md
Edit and Delete button accessibility text in SharedMacroRow, MacroRow, ChordRow, SequenceRow, ScriptRow, and the empty-state example buttons now include the item's name (with "Untitled …" fallbacks). The pattern is documented in the palette.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 Hop, hop, through the list I go,
Each button now has a name to show.
"Edit Macro Turbo Dash!" the VoiceOver cries,
No more mystery "Edit" to confuse tired eyes.
Item-specific labels — what a delight!
Accessibility labels done just right. 🎮

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding dynamic, item-specific accessibility context in list views.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch palette-dynamic-accessibility-context-13112545269818779337

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@XboxControllerMapper/XboxControllerMapper/Views/MainWindow/ChordSequenceListViews.swift`:
- Around line 118-127: The tooltip and accessibility text for chord actions
still use actionDisplayString, which collapses macro/script entries to generic
labels. Update ChordRow so its .help and .accessibilityLabel use the
already-resolved chord action name (for example via the existing resolved label
logic) instead of actionDisplayString, and apply the same change to both button
groups referenced in ChordSequenceListViews.

In
`@XboxControllerMapper/XboxControllerMapper/Views/Scripts/ScriptListView.swift`:
- Around line 132-133: The example card action is replacing the synthesized
accessibility label with only “Use … example,” which removes the visible
title/description context. In ScriptListView’s example card accessibility
modifier, keep the existing content from example.name and example.description
instead of setting a custom accessibilityLabel, and move the action wording into
the accessibility hint so the card remains fully descriptive to screen readers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5c1e52cc-c5a1-4180-880a-b113f63b00f8

📥 Commits

Reviewing files that changed from the base of the PR and between 15e1f1d and 5c31f41.

📒 Files selected for processing (4)
  • .Jules/palette.md
  • XboxControllerMapper/XboxControllerMapper/Views/Macros/MacroListView.swift
  • XboxControllerMapper/XboxControllerMapper/Views/MainWindow/ChordSequenceListViews.swift
  • XboxControllerMapper/XboxControllerMapper/Views/Scripts/ScriptListView.swift

Comment on lines +118 to +127
.help("Edit chord \(chord.actionDisplayString)")
.accessibilityLabel("Edit chord \(chord.actionDisplayString)")

Button(action: onDelete) {
Image(systemName: "trash")
.foregroundColor(.red.opacity(0.8))
}
.buttonStyle(.borderless)
.help("Delete")
.accessibilityLabel("Delete")
.help("Delete chord \(chord.actionDisplayString)")
.accessibilityLabel("Delete chord \(chord.actionDisplayString)")

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use the resolved action name here, not actionDisplayString.

Lines 118-127 and 264-273 still become generic for macro/script mappings because actionDisplayString returns "Macro" / "Script" in those cases. ChordRow already resolves the actual macro/script name for the visible label, so the new tooltip/VoiceOver text remains ambiguous in repeated lists.

♿ Suggested direction
- .help("Edit chord \(chord.actionDisplayString)")
- .accessibilityLabel("Edit chord \(chord.actionDisplayString)")
+ .help("Edit chord \(resolvedChordActionName)")
+ .accessibilityLabel("Edit chord \(resolvedChordActionName)")

- .help("Delete sequence \(sequence.actionDisplayString)")
- .accessibilityLabel("Delete sequence \(sequence.actionDisplayString)")
+ .help("Delete sequence \(resolvedSequenceActionName)")
+ .accessibilityLabel("Delete sequence \(resolvedSequenceActionName)")
private var resolvedChordActionName: String {
    if let systemCommand = chord.systemCommand { return chord.hint ?? systemCommand.displayName }
    if let macroId = chord.macroId,
       let profile = profileManager.activeProfile,
       let macroName = profile.macroDisplayName(for: macroId) {
        return chord.hint ?? macroName
    }
    if let scriptId = chord.scriptId,
       let profile = profileManager.activeProfile,
       let script = profile.scripts.first(where: { $0.id == scriptId }) {
        return chord.hint ?? script.name
    }
    return chord.hint ?? chord.actionDisplayString
}

Also applies to: 264-273

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@XboxControllerMapper/XboxControllerMapper/Views/MainWindow/ChordSequenceListViews.swift`
around lines 118 - 127, The tooltip and accessibility text for chord actions
still use actionDisplayString, which collapses macro/script entries to generic
labels. Update ChordRow so its .help and .accessibilityLabel use the
already-resolved chord action name (for example via the existing resolved label
logic) instead of actionDisplayString, and apply the same change to both button
groups referenced in ChordSequenceListViews.

Comment on lines +132 to +133
.help("Use \(example.name) example")
.accessibilityLabel("Use \(example.name) example")

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Don’t replace the example card’s synthesized label.

Line 133 likely strips out the visible description from the accessibility tree and reduces the button to just “Use … example”. These cards already expose example.name and example.description; keeping that content and moving the action wording to a hint preserves more context for screen-reader users.

♿ Suggested fix
 .help("Use \(example.name) example")
-.accessibilityLabel("Use \(example.name) example")
+.accessibilityHint("Use \(example.name) example")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.help("Use \(example.name) example")
.accessibilityLabel("Use \(example.name) example")
.help("Use \(example.name) example")
.accessibilityHint("Use \(example.name) example")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@XboxControllerMapper/XboxControllerMapper/Views/Scripts/ScriptListView.swift`
around lines 132 - 133, The example card action is replacing the synthesized
accessibility label with only “Use … example,” which removes the visible
title/description context. In ScriptListView’s example card accessibility
modifier, keep the existing content from example.name and example.description
instead of setting a custom accessibilityLabel, and move the action wording into
the accessibility hint so the card remains fully descriptive to screen readers.

Added dynamic, item-specific context to icon-only edit and delete buttons in SwiftUI repeated lists (`ScriptListView`, `MacroListView`, and `ChordSequenceListViews`) to disambiguate actions for screen readers and tooltip users. Updated `.Jules/palette.md` to document this learning.

Co-authored-by: NSEvent <44446865+NSEvent@users.noreply.github.com>
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