Skip to content
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 new rule no-aria-unsupported-elements #2507

Conversation

thegilby
Copy link
Contributor

This PR adds the new rule no-aria-unsupported-elements which fixes #2504.

Background

Certain reserved DOM elements like meta, html, script, style do not support ARIA roles, states and properties. This is often because they are not visible. This rule enforces that these DOM elements do not contain the role and/or aria-* props.

Reference: Understanding Success Criterion 4.1.2: Name, Role, Value

Allowed

# examples
<meta charset="UTF-8" />
<html lang="en"></html>
<script></script>

Forbidden:

# examples
<meta charset="UTF-8" aria-hidden="false" />
<html lang="en" role="application"></html>
<script aria-hidden="false"></script>

Testing

Test Suites: 138 passed, 138 total
Tests:       5 skipped, 7601 passed, 7606 total
Snapshots:   999 passed, 999 total
Time:        114.355 s, estimated 124 s
Ran all test suites.

lib/rules/no-aria-unsupported-elements.js Outdated Show resolved Hide resolved
lib/rules/no-aria-unsupported-elements.js Outdated Show resolved Hide resolved
test/unit/rules/no-aria-unsupported-elements-test.js Outdated Show resolved Hide resolved
docs/rule/no-aria-unsupported-elements.md Outdated Show resolved Hide resolved
@thegilby thegilby requested a review from bmish May 13, 2022 07:14
Copy link
Member

@bmish bmish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@bmish bmish merged commit 4aa3062 into ember-template-lint:master May 13, 2022
@bmish
Copy link
Member

bmish commented May 13, 2022

Will plan to make this a recommended rule in v5 (#2319) (let me know if you disagree with that).

@thegilby
Copy link
Contributor Author

Will plan to make this a recommended rule in v5 (#2319) (let me know if you disagree with that).

No problem with that at all @bmish! Thank you! 🙇🏽‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal for new a11y check to disallow ARIA props on elements that do not support them
2 participants