rebelappstudio / accessibility_tools

MIT License
67 stars 4 forks source link

Add inputs label checker #25

Closed aednlaxer closed 1 year ago

aednlaxer commented 1 year ago

This pull request adds a new checker (#4). Input label checker checks if inputs (text fields, checkboxes, radio buttons, switches) have semantic labels.

Example of a failing check:

TextField()

Example of a passing check:

TextField(
    decoration: InputDecorartion(
        hint: 'This is hint',
    ),
)

In the latter example hint becomes a semantic label and is visible to screen readers. Text fields may use hint, labelText or label and these work fine with the checker which is demonstrated in input_label_checker_test.dart

Note: this new checker is on by default

In addition, checkers now have to provide resolution guidance with example on how issues could be fixed (#26).

Closes #4 Closes #26

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (4d6a26e) 100.00% compared to head (170ed64) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #25 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 8 9 +1 Lines 287 326 +39 ========================================= + Hits 287 326 +39 ``` | [Impacted Files](https://codecov.io/gh/rebelappstudio/accessibility_tools/pull/25?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=rebelappstudio) | Coverage Δ | | |---|---|---| | [lib/src/checkers/flex\_overflow\_checker.dart](https://codecov.io/gh/rebelappstudio/accessibility_tools/pull/25?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=rebelappstudio#diff-bGliL3NyYy9jaGVja2Vycy9mbGV4X292ZXJmbG93X2NoZWNrZXIuZGFydA==) | `100.00% <ø> (ø)` | | | [lib/src/accessibility\_issue.dart](https://codecov.io/gh/rebelappstudio/accessibility_tools/pull/25?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=rebelappstudio#diff-bGliL3NyYy9hY2Nlc3NpYmlsaXR5X2lzc3VlLmRhcnQ=) | `100.00% <100.00%> (ø)` | | | [lib/src/accessibility\_tools.dart](https://codecov.io/gh/rebelappstudio/accessibility_tools/pull/25?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=rebelappstudio#diff-bGliL3NyYy9hY2Nlc3NpYmlsaXR5X3Rvb2xzLmRhcnQ=) | `100.00% <100.00%> (ø)` | | | [lib/src/checker\_manager.dart](https://codecov.io/gh/rebelappstudio/accessibility_tools/pull/25?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=rebelappstudio#diff-bGliL3NyYy9jaGVja2VyX21hbmFnZXIuZGFydA==) | `100.00% <100.00%> (ø)` | | | [lib/src/checkers/checker\_base.dart](https://codecov.io/gh/rebelappstudio/accessibility_tools/pull/25?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=rebelappstudio#diff-bGliL3NyYy9jaGVja2Vycy9jaGVja2VyX2Jhc2UuZGFydA==) | `100.00% <100.00%> (ø)` | | | [lib/src/checkers/input\_label\_checker.dart](https://codecov.io/gh/rebelappstudio/accessibility_tools/pull/25?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=rebelappstudio#diff-bGliL3NyYy9jaGVja2Vycy9pbnB1dF9sYWJlbF9jaGVja2VyLmRhcnQ=) | `100.00% <100.00%> (ø)` | | | [lib/src/checkers/minimum\_tap\_area\_checker.dart](https://codecov.io/gh/rebelappstudio/accessibility_tools/pull/25?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=rebelappstudio#diff-bGliL3NyYy9jaGVja2Vycy9taW5pbXVtX3RhcF9hcmVhX2NoZWNrZXIuZGFydA==) | `100.00% <100.00%> (ø)` | | | [lib/src/checkers/semantic\_label\_checker.dart](https://codecov.io/gh/rebelappstudio/accessibility_tools/pull/25?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=rebelappstudio#diff-bGliL3NyYy9jaGVja2Vycy9zZW1hbnRpY19sYWJlbF9jaGVja2VyLmRhcnQ=) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=rebelappstudio). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=rebelappstudio)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

aednlaxer commented 1 year ago

Found a bug when no accessibility issues found for ToggleButtons with icons (and perhaps some other form widgets with missing semantic labels). Added a test and fixed the issue in 48c3b60693325435c1bc4d1bee01a8d6333b17fb

jpsiitonen commented 1 year ago

Latest change seems to work also with ToggleButtons