dequelabs / dequelabs/axe-core

html-has-lang rule is not triggered when there is no html start tag

Open
#4,251 2 comments 1 reaction 0 assignees View on GitHub
linting question
Dominant language
JavaScript
Stars
7.5k
Forks
933
Avg merge
2d 23h
Merged PRs (30d)
17

Description

### Product

axe Linter

### Product Version

4.8.0

### Latest Version

- [X] I have tested the issue with the latest version of the product

### Issue Description

#### Expectation

When there is no `lang` attribute that identifies the main language of the page, I expect the html-has-lang rule to be triggered.

#### Actual

When the page has no `html` start tag, the html-has-lang rule does not check whether the main language is identified by a different means.

#### How to Reproduce

The rule is not triggered by the following code snippet:

```

Test Page for Linters

Test Page for Linters


```

Note that this is perfectly valid HTML 5 because the start and end tags for `html`, `head` and `body` are optional. However, the code fails WCAG SC 3.1.1.

#### Additional context

See the related issue #4250.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.