From b2ccfa82e1c99fa6fe120abdaae8adc269f4c868 Mon Sep 17 00:00:00 2001 From: Abdullah Hashim Date: Wed, 6 May 2026 07:21:19 -0400 Subject: [PATCH 1/7] Recognize sr-only accessible names via accessible_name_wrapper_classes --- CHANGELOG.md | 4 + lib/a11y/lint/configuration.rb | 5 ++ lib/a11y/lint/phlex_node.rb | 7 ++ lib/a11y/lint/phlex_runner.rb | 15 +++- .../lint/phlex_runner/block_text_scanner.rb | 21 ++++- lib/a11y/lint/phlex_runner/phlex_call.rb | 6 +- ...st_anchor_missing_accessible_name_phlex.rb | 80 +++++++++++++++++++ ...st_button_missing_accessible_name_phlex.rb | 80 +++++++++++++++++++ test/a11y/lint/test_configuration.rb | 35 ++++++++ test/fixtures/dummy_app/.a11y-lint.yml | 7 ++ .../fixtures/dummy_app/app/views/home_view.rb | 19 +++++ 11 files changed, 271 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36eb26f..cd2c9ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- `.a11y-lint.yml` now supports a top-level `accessible_name_wrapper_classes` list. Inside Phlex `a`/`button` tags whose direct child has a matching class, `AnchorMissingAccessibleName` and `ButtonMissingAccessibleName` treat ambiguous bare calls — receiverless calls whose name matches an HTML tag, with no arguments and no block — as text-emitting method calls rather than empty HTML elements. Fixes false positives on the `span(class: "sr-only") { label }` pattern, where `label` is an instance method that parses as a `Prism::CallNode` indistinguishable from the `