-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Accessibility Font Size Rule #5398
Closed
MartijnAmbagtsheer
wants to merge
12
commits into
realm:main
from
MartijnAmbagtsheer:martijnambagtsheer/AccessibilityFontSizeRule
Closed
Add Accessibility Font Size Rule #5398
MartijnAmbagtsheer
wants to merge
12
commits into
realm:main
from
MartijnAmbagtsheer:martijnambagtsheer/AccessibilityFontSizeRule
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MartijnAmbagtsheer
force-pushed
the
martijnambagtsheer/AccessibilityFontSizeRule
branch
from
December 20, 2023 09:49
2f69669
to
5c56216
Compare
The ownership of the code has been modified. A new PR can be found here: #5436 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The text below has been taken from the
rule request
template.1. Why should this rule be added? Share links to existing discussion about what the community thinks about this.
The increasing focus on accessibility in both America through the ADA (Americans with Disabilities Act) and the upcoming European legislation underscores the growing importance of accessible applications. To assist in this effort, we can identify existing inaccessible elements using tools such as SwiftLint, among others.
There are already two rules for testing the accessibility of images and buttons. With this new rule, I aim to align with the WCAG (Web Content Accessibility Guidelines) 1.4.4. This guideline stipulates that every text must be scalable.
2. Provide several examples of what would and wouldn't trigger violations.
Insofar as I have been able to find, SwiftUI inherently scales well on its own, but this can be forcibly disabled using the
.font(.system())
modifier.Using the default Text, without the .font(.system(size:)) modifier would work and not trigger the linter.
This also applies to other view elements like a Button, TextField or SecureField.
3. Should the rule be configurable, if so what parameters should be configurable?
For this rule, no additional configuration is required.
4. Should the rule be opt-in or enabled by default? Why?
See README.md for guidelines on when to mark a rule as opt-in.
As stated in the rules in the README, this rule complies with the guidelines to be opt-in, as the rule, like the other accessibility rules, is opt-in due to potential false positives given the many possibilities to set up a view within SwiftUI.