Skip to content

Proposal: include lang rule in jsx-a11y/strict config #750

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

Open
rkpatel7 opened this issue Oct 9, 2020 · 3 comments
Open

Proposal: include lang rule in jsx-a11y/strict config #750

rkpatel7 opened this issue Oct 9, 2020 · 3 comments

Comments

@rkpatel7
Copy link

rkpatel7 commented Oct 9, 2020

Current state

jsx-a11y/strict does not include the jsx-a11y/lang rule but does include the jsx-a11y/html-has-lang rule.

Context

Looking at the jsx-a11y/lang source code and jsx-a11y/html-has-lang source code, it appears that the latter ensures that html elements have a lang attribute with any value and the former additionally checks if the lang attribute's value conforms to the BCP 47 list of acceptable tags. To satisfy WCAG 3.1.1, technique H57 is sufficient but that technique requires both of the following to be true:

  • html element has a lang attribute (checked by rule jsx-a11y/html-has-lang, included in jsx-a11y/strict)
  • lang attribute conforms to BCP 47 (checked by rule jsx-a11y/lang, NOT included in jsx-a11y/strict)

Proposal:

In order to wholly satisfy WCAG 3.1.1:

  • jsx-a11y/lang MUST be included in jsx-a11y/strict
  • jsx-a11y/lang SHOULD be included jsx-a11y/recommended1

1: I am not sure what the criteria is for including a rule in jsx-a11y/recommended but given that WCAG 3.1.1 would only be sufficiently covered with the inclusion of jsx-a11y/lang, I think it would make sense to include the rule in both configs.

@ljharb
Copy link
Member

ljharb commented Oct 9, 2020

Adding rules to a config is a breaking change, and it's not worth making a breaking change just to do that.

A TODO comment, however, to make these changes would be great, for whenever a breaking change is already forced.

@rkpatel7
Copy link
Author

I think that's a good middle ground. I'd be happy to make a pull request with the TODO comment. Let me know if that is acceptable and, if so, what contributing guidelines/docs there are (I couldn't find any in the repo). Thanks!

@ljharb
Copy link
Member

ljharb commented Oct 12, 2020

Sure, that'd be great. We don't have any docs around contributing; infer from the repo what you can, and I'll provide feedback on the PR as needed.

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

No branches or pull requests

2 participants