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

New rule: xml-lang #531

Closed
jmucha opened this issue Sep 15, 2017 · 7 comments
Closed

New rule: xml-lang #531

jmucha opened this issue Sep 15, 2017 · 7 comments
Labels
rules Issue or false result from an axe-core rule

Comments

@jmucha
Copy link

jmucha commented Sep 15, 2017

SC3-1-1-xml-lang

This test checks the value of the xml:lang attribute and the presence of the lang attribute.

Tags: wcag2a, wcag311, cat.language

Selector

Select the root if it has both attributes html[xml:lang][lang].

Checks

language/xml-lang

  1. Check that the value of the xml:lang attribute is equal to the lang attribute. If true, pass; else 2.

language/xml-lang-dialect

  1. Check that the language can match different dialects, e.g.
  • <html lang="en" xml:lang="en-US">
  • <html xml:lang="nl" lang="nl-BE">

If true, pass; else fail.

@marcysutton marcysutton added the rules Issue or false result from an axe-core rule label Sep 15, 2017
@WilcoFiers
Copy link
Contributor

Few suggestions for this one too:

  1. In the selector, have this rule only target the root if it has both attributes: html[xml:lang][lang]

  2. I think you should add a second rule for 3.1.2 that tests the same thing but for other elements.

  3. I think we should allow the following. These are effectively the same thing. We'll need tests for that.

    • <html lang="en" xml:lang="en-US">
    • <html xml:lang="nl" lang="nl-BE">

@jmucha jmucha changed the title New rule: SC3-1-1-xml-lang - identical xml:lang and lang attributes New rule: xml-lang Sep 26, 2017
@jmucha
Copy link
Author

jmucha commented Sep 26, 2017

Which other elements do you mean @WilcoFiers ? Could you elaborate on this one? Are you thinking about the phrases in text in other languages?

@WilcoFiers
Copy link
Contributor

@jmucha I mean just any other element. Any element which has both lang and xml:lang should have it match.

@jmucha
Copy link
Author

jmucha commented Sep 29, 2017

Ok, got it, thank you. We can make a separate rule for the language of parts then.

@jmucha
Copy link
Author

jmucha commented Jan 19, 2018

Any ideas on how to solve a problem with testing the rule when there arises an error stating that html element cannot be added to the div element? Do you have any experience how to approach this?
The whole json file looks like this:

<html lang="en" xml:lang="en" id="pass1">English</html>

@marcysutton
Copy link
Contributor

I'd say that might have to be an integration test where you can control the whole DOM, as our unit tests are already inside of a document. Or use an element other than <html>.

@jeeyyy
Copy link
Contributor

jeeyyy commented Sep 5, 2018

Believe this PR #999 tackles the above issue.

@jeeyyy jeeyyy closed this as completed Sep 5, 2018
mrtnvh pushed a commit to mrtnvh/axe-core that referenced this issue Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rules Issue or false result from an axe-core rule
Projects
None yet
Development

No branches or pull requests

4 participants