Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ struct ChartView: View {
x: .value("Amount", category.amount)
)
.foregroundStyle(category.color)
.accessibilityLabel(Text(category.name))
.accessibilityValue(Text("\(category.amount, specifier: "%.2f")"))
.accessibilityAddTraits(.isButton)
.accessibilityIdentifier("BarMark_\(category.name)")
}
.chartPlotStyle { plotArea in
plotArea
Expand All @@ -31,6 +35,10 @@ struct ChartView: View {
.chartXScale(domain: 0...totalAmount)
.chartXAxis(.hidden)
.frame(height: 25)
.accessibilityElement(children: .contain)
.accessibilityLabel(Text("Category Amounts Bar Chart"))
.accessibilityHint(Text("Tap a bar to select a category."))
.accessibilityIdentifier("CategoryBarChart")
.chartOverlay { proxy in
GeometryReader { geometry in
Rectangle().fill(.clear).contentShape(Rectangle())
Expand All @@ -50,6 +58,7 @@ struct ChartView: View {
}
}
}
.accessibilityHidden(true)
}
}
}
Expand Down
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Your Name

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ This GitHub Action automatically reviews and applies accessibility improvements
- Process only SwiftUI files that were changed in the current commit.
- **Pull Request Creation**: Automatically creates a pull request with the applied changes.

## Inspiration

This project was inspired by the talk and work of Allison McEntire on accessibility. You can find more about her insights here: [gist.github.com/allisonpaigemcentire](https://gist.github.com/allisonpaigemcentire/719b856796d599e9d758e8a1343b5bd8).

## Important Considerations

- **Code Modification**: This bot directly modifies your codebase by applying accessibility improvements. It is **highly recommended** that you carefully review all changes proposed in the pull requests created by this bot before merging them.
- **Model Behavior**: The quality and nature of the suggestions depend on the OpenAI model used. While the bot aims to apply only additive accessibility modifiers, always verify the changes.

## Prerequisites

1. **OpenAI API Key**: You need an OpenAI API key with access to the desired models. This key should be stored as a secret in your GitHub repository (e.g., `OPENAI_API_KEY`).
Expand Down Expand Up @@ -43,10 +52,15 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Recommended for processing changed files or reliable base branch detection
# fetch-depth: 0 is recommended to fetch all history.
# This is crucial if using `process_changed_files_only: true`
# or if your action needs to reliably determine the base branch for PRs.
fetch-depth: 0

- name: Run SwiftUI Accessibility Bot
uses: your-username/swiftui-accessibility-bot@v1 # Replace with your action's path or version
env:
GH_TOKEN: ${{ github.token }} # Pass the GitHub token for PR creation and push
with:
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
# Optional: Specify a different OpenAI model
Expand Down