eslint-plugin-lit-a11y
Version:
linting plugin for lit-a11y
62 lines (42 loc) • 1.05 kB
Markdown
# scope
Enforce scope attribute is only used on <th> elements.
The scope attribute may only be used on `<th>` elements.
## Rule Details
This rule aims to prevent invalid use of `scope` attribute.
Examples of **incorrect** code for this rule:
```js
html` <td scope="row"></td> `;
```
```js
html` <div scope="col"></div> `;
```
```js
html` <th scope="foo"></div> `;
```
Examples of **correct** code for this rule:
```js
html` <th scope="col"></th> `;
```
```js
html` <th scope="row"></th> `;
```
```js
html` <th scope="colgroup"></th> `;
```
```js
html` <th scope="rowgroup"></th> `;
```
```js
html` <foo-bar scope="col"></div> `;
```
```js
html` <foo-bar scope="row"></div> `;
```
```js
html` <foo-bar scope="foo"></div> `;
```
## When Not To Use It
When you do not use the `scope` attribute in your lit-html templates.
## Further Reading
- [MDN: `<th>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope)
- [WebAIM: Creating Accessible Tables](https://webaim.org/techniques/tables/data#headers)