{"id":19593033,"url":"https://github.com/thoughtbot/capybara_accessibility_audit","last_synced_at":"2025-10-08T17:14:06.182Z","repository":{"id":50518882,"uuid":"511937528","full_name":"thoughtbot/capybara_accessibility_audit","owner":"thoughtbot","description":"Accessibility tooling for Capybara","archived":false,"fork":false,"pushed_at":"2025-05-23T15:40:07.000Z","size":64,"stargazers_count":72,"open_issues_count":6,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-28T04:05:33.439Z","etag":null,"topics":["a11y","accessibility","capybara","rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thoughtbot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"MIT-LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"thoughtbot"}},"created_at":"2022-07-08T15:13:05.000Z","updated_at":"2025-08-20T14:56:16.000Z","dependencies_parsed_at":"2022-08-31T07:01:14.689Z","dependency_job_id":"4563f68a-ff75-4c8a-bc4b-76f64342cb5b","html_url":"https://github.com/thoughtbot/capybara_accessibility_audit","commit_stats":{"total_commits":29,"total_committers":7,"mean_commits":4.142857142857143,"dds":"0.48275862068965514","last_synced_commit":"4e3837fad39f667de26b2ff5cdc839725b6a09ed"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/thoughtbot/capybara_accessibility_audit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoughtbot%2Fcapybara_accessibility_audit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoughtbot%2Fcapybara_accessibility_audit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoughtbot%2Fcapybara_accessibility_audit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoughtbot%2Fcapybara_accessibility_audit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thoughtbot","download_url":"https://codeload.github.com/thoughtbot/capybara_accessibility_audit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thoughtbot%2Fcapybara_accessibility_audit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278150156,"owners_count":25938309,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a11y","accessibility","capybara","rails"],"created_at":"2024-11-11T08:37:53.612Z","updated_at":"2025-10-08T17:14:06.152Z","avatar_url":"https://github.com/thoughtbot.png","language":"Ruby","funding_links":["https://github.com/sponsors/thoughtbot"],"categories":[],"sub_categories":[],"readme":"# CapybaraAccessibilityAudit\n\nExtend your Capybara-powered System Tests to automatically audit the page for\n[WCAG Standards-based accessibility violations](https://www.w3.org/WAI/standards-guidelines/wcag/).\n\n## Usage\n\n```\nFailure:\nFound 1 accessibility violation:\n\n1) label: Form elements must have labels (critical)\n    https://dequeuniversity.com/rules/axe/4.4/label?application=axeAPI\n    The following 1 node violate this rule:\n\n        Selector: input\n        HTML: \u003cinput\u003e\n        Fix any of the following:\n        - Form element does not have an implicit (wrapped) \u003clabel\u003e\n        - Form element does not have an explicit \u003clabel\u003e\n        - aria-label attribute does not exist or is empty\n        - aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty\n        - Element has no title attribute\n        - Element has no placeholder attribute\n        - Element's default semantics were not overridden with role=\"none\" or role=\"presentation\"\n\nInvocation: axe.run({:exclude=\u003e[]}, {}, callback);\n```\n\nInstalling the gem will automatically configure your System Tests to audit for\naccessibility violations after common actions, including:\n\n* [`visit`](https://rubydoc.info/github/teamcapybara/capybara/master/Capybara/Session:visit)\n* [`click_button`](https://rubydoc.info/github/teamcapybara/capybara/master/Capybara/Node/Actions#click_button-instance_method)\n* [`click_link`](https://rubydoc.info/github/teamcapybara/capybara/master/Capybara/Node/Actions#click_link-instance_method)\n* [`click_link_or_button`](https://rubydoc.info/github/teamcapybara/capybara/master/Capybara/Node/Actions#click_link_or_button-instance_method)\n* [`click_on`](https://rubydoc.info/github/teamcapybara/capybara/master/Capybara/Node/Actions:click_on)\n\nUnder the hood, `capybara_accessibility_audit` relies on [axe-core-rspec][], which uses [aXe][]\nto audit for accessibility violations. To configure which options are passed to\nthe `be_axe_clean` matcher, override the class-level\n`accessibility_audit_options`. Supported keys include:\n\n* [`according_to:`](https://github.com/dequelabs/axe-core-gems/blob/develop/packages/axe-core-rspec/README.md#according_to---accessibility-standard-tag-clause)\n* [`checking_only:`](https://github.com/dequelabs/axe-core-gems/blob/develop/packages/axe-core-rspec/README.md#checking_only---exclusive-rules-clause)\n* [`checking:`](https://github.com/dequelabs/axe-core-gems/blob/develop/packages/axe-core-rspec/README.md#checking---checking-rules-clause)\n* [`excluding:`](https://github.com/dequelabs/axe-core-gems/blob/develop/packages/axe-core-rspec/README.md#excluding---exclusion-clause)\n* [`skipping:`](https://github.com/dequelabs/axe-core-gems/blob/develop/packages/axe-core-rspec/README.md#skipping---skipping-rules-clause)\n* [`within:`](https://github.com/dequelabs/axe-core-gems/blob/develop/packages/axe-core-rspec/README.md#within---inclusion-clause)\n\nTo override the class-level setting, wrap code in calls to the\n`with_accessibility_audit_options` method:\n\n```ruby\nwith_accessibility_audit_options according_to: :wcag21aaa do\n  visit page_with_violations_path\nend\n```\n\n[aXe]: https://www.deque.com/axe/\n[axe-core-rspec]: https://github.com/dequelabs/axe-core-gems/blob/develop/packages/axe-core-rspec/README.md#matcher\n\n## Frequently Asked Questions\n\nMy application already exists, automated accessibility audits are uncovering violations left and right. Do I have to fix them all at once?\n---\n\nYour suite has control over which rules are skipped and which rules are\nenforced through the `accessibility_audit_options` configuration.\n\nConfiguration overrides can occur at any scope, ranging from class-wide to\nblock-wide.\n\nFor example, to skip a rule at the suite-level, override it in your\n`ApplicationSystemTestCase`:\n\n```ruby\nclass ApplicationSystemTestCase \u003c ActionDispatch::SystemTestCase\n  accessibility_audit_options.skipping = %w[label button-name image-alt]\nend\n```\n\nTo skip a rule at the test-level, wrap the test in a\n`with_accessibility_audit_options` block:\n\n```ruby\nclass MySystemTest \u003c ApplicationSystemTestCase\n  test \"with overridden accessibility audit options\" do\n    with_accessibility_audit_options skipping: %w[label button-name image-alt] do\n      visit examples_path\n      # ...\n    end\n  end\nend\n```\n\nTo skip a rule at the block-level, wrap the code in a\n`with_accessibility_audit_options` block:\n\n```ruby\nclass MySystemTest \u003c ApplicationSystemTestCase\n  test \"with overridden accessibility audit options\" do\n    visit examples_path\n\n    with_accessibility_audit_options skipping: %w[label button-name image-alt] do\n      click_on \"A link to a page with a violation\"\n    end\n\n    # ...\n  end\nend\n```\n\nAs you resolve the violations, you can remove entries from the list of skipped\nrules.\n\nI've implemented a custom Capybara action to toggle a disclosure element. How can I automatically audit for violations after it's called?\n---\n\nYou can add the method to the list of methods that will initiate an automated\naudit:\n\n```ruby\nclass ApplicationSystemTestCase \u003c ActionDispatch::SystemTestCase\n  def toggle_disclosure(locator)\n    # ...\n  end\n\n  accessibility_audit_after :toggle_disclosure\nend\n```\n\nHow can I turn off auditing for the entire suite?\n---\n\nYou can disable automated auditing within your `ApplicationSystemTestCase`:\n\n```ruby\nclass ApplicationSystemTestCase \u003c ActionDispatch::SystemTestCase\n  self.accessibility_audit_enabled = false\nend\n```\n\nHow can I turn off auditing for a block of code?\n---\n\nYou can disable automated auditing temporarily by wrapping code in a\n`skip_accessibility_audits` block:\n\n```ruby\nclass MySystemTest \u003c ApplicationSystemTestCase\n  test \"with overridden accessibility audit options\" do\n    skip_accessibility_audits do\n      visit a_page_with_violations_path\n\n      click_on \"A link to a page with a violation\"\n    end\n\n    # ...\n  end\nend\n```\n\nHow can I turn off auditing hooks for a method?\n---\n\nYou can remove the method from the test's [Set][] of\n`accessibility_audit_after_methods` configuration by calling\n`skip_accessibility_audit_after`:\n\n```ruby\nclass ApplicationSystemTestCase \u003c ActionDispatch::SystemTestCase\n  skip_accessibility_audit_after :visit\nend\n```\n\n[Set]: https://ruby-doc.org/stdlib-3.0.1/libdoc/set/rdoc/Set.html\n\nHow can I turn off auditing for a test file?\n---\n\nYou can disable automated auditing at the class-level:\n\n```ruby\nclass MySystemTest \u003c ApplicationSystemTestCase\n  self.accessibility_audit_enabled = false\nend\n```\n\nAs you gradually address violations, you can re-enable audits within\n`with_accessibility_audits` blocks:\n\n```ruby\nclass MySystemTest \u003c ApplicationSystemTestCase\n  self.accessibility_audit_enabled = false\n\n  test \"a test with a violation\" do\n    visit examples_path\n\n    with_accessibility_audits do\n      click_on \"A link to a page with violations\"\n    end\n  end\nend\n```\n\n## Installation\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"capybara_accessibility_audit\"\n```\n\nAnd then execute:\n```bash\n$ bundle\n```\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](./CONTRIBUTING.md).\n\n## License\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n\u003c!-- START /templates/footer.md --\u003e\n## About thoughtbot\n\n![thoughtbot](https://thoughtbot.com/thoughtbot-logo-for-readmes.svg)\n\nThis repo is maintained and funded by thoughtbot, inc.\nThe names and logos for thoughtbot are trademarks of thoughtbot, inc.\n\nWe love open source software!\nSee [our other projects][community].\nWe are [available for hire][hire].\n\n[community]: https://thoughtbot.com/community?utm_source=github\n[hire]: https://thoughtbot.com/hire-us?utm_source=github\n\n\n\u003c!-- END /templates/footer.md --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthoughtbot%2Fcapybara_accessibility_audit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthoughtbot%2Fcapybara_accessibility_audit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthoughtbot%2Fcapybara_accessibility_audit/lists"}