-
Notifications
You must be signed in to change notification settings - Fork 78
Rule: Table header cells have corresponding data cells (d0f69e) #417
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
Merged
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
9e42589
rule: table heeader cells refer to data cells
jeeyyy abaef6a
test: add test cases
jeeyyy cba574e
fix: udpate based on rreviews
jeeyyy 41729e6
merge from develop
jeeyyy c6d6805
update rule
jeeyyy 1b9e9d1
delete layout table def
jeeyyy e184b81
Update table-header-cells-refer-to-data-cells-d0f69e.md
jeeyyy 327ce1c
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 0c4e650
update rule
jeeyyy 5ce8958
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 4a8f73b
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 681fffc
update
jeeyyy 3c06dd3
merge from devellop
jeeyyy a915f91
updates
jeeyyy 38a14e8
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 7d1f313
Merge branch 'develop' into rule-th-refers-cells
jeeyyy bfea1a6
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 08e8be2
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 9b4f790
update
jeeyyy eb912da
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 62fda4e
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 84ae7b4
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 114cc4b
update
jeeyyy 110e2e4
update
jeeyyy 5714782
Merge branch 'develop' into rule-th-refers-cells
jeeyyy cd848a5
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 2283656
Merge branch 'develop' into rule-th-refers-cells
jeeyyy acdeaec
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 085c3e7
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 15d965d
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 29d943c
Merge branch 'develop' into rule-th-refers-cells
jeeyyy dec9af3
chore: merge from develop
jeeyyy f6c3474
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 52de444
Merge branch 'develop' into rule-th-refers-cells
jeeyyy c2e3975
Merge branch 'develop' into rule-th-refers-cells
WilcoFiers 789ec7b
Merge branch 'develop' into rule-th-refers-cells
jeeyyy d53d6a1
fix: update applicability and expectation
jeeyyy a05a662
fix: update examples
jeeyyy 5293c2a
fix: failing tests
jeeyyy 6818eb5
Merge branch 'develop' into rule-th-refers-cells
jeeyyy f0c3bf7
updated
jeeyyy f1784d0
Merge branch 'develop' into rule-th-refers-cells
jeeyyy 8ebf527
fix: frontmatter
jeeyyy 85205f1
update
jeeyyy af38ffd
Merge branch 'develop' into rule-th-refers-cells
jeeyyy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
202 changes: 202 additions & 0 deletions
202
_rules/table-header-cells-refer-to-data-cells-d0f69e.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
--- | ||
id: d0f69e | ||
name: All table header cells have corresponding data cells | ||
rule_type: atomic | ||
description: | | ||
This rule checks that each table header has corresponding data cells in a table element. | ||
accessibility_requirements: | ||
wcag20:1.3.1: # Info and Relationships (A) | ||
forConformance: true | ||
failed: not satisfied | ||
passed: further testing needed | ||
inapplicable: further testing needed | ||
input_aspects: | ||
- DOM Tree | ||
authors: | ||
- Jey Nandakumar | ||
- Audrey Maniez | ||
--- | ||
|
||
## Applicability | ||
|
||
The rule applies to any HTML element that is a [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant) in the [flat tree](https://drafts.csswg.org/css-scoping/#flat-tree) of an element having a [semantic role](#semantic-role) of either [table](https://www.w3.org/TR/wai-aria-1.1/#table) or [grid](https://www.w3.org/TR/wai-aria-1.1/#grid), and is [visible](#visible) as well as [included in the accessibility tree](#included-in-the-accessibility-tree), where the element has any of the following [semantic roles](#semantic-role): | ||
|
||
- [cell](https://www.w3.org/TR/wai-aria-1.1/#cell) | ||
- [gridcell](https://www.w3.org/TR/wai-aria-1.1/#gridcell) | ||
- [rowheader](https://www.w3.org/TR/html-aria/#index-aria-rowheader) | ||
- [columnheader](https://www.w3.org/TR/html-aria/#index-aria-columnheader) | ||
|
||
## Expectation | ||
|
||
The target element is either the row or column header for cells that is a [descendant](https://dom.spec.whatwg.org/#concept-tree-descendant) in the [flat tree](https://drafts.csswg.org/css-scoping/#flat-tree) of the same [table](https://www.w3.org/TR/wai-aria-1.1/#table) or [grid](https://www.w3.org/TR/wai-aria-1.1/#grid) element, as that of the target element. | ||
|
||
**Note:** Assigning headers cells to data cell is performed as per algorithm - [Forming relationships between data cells and header cells](https://html.spec.whatwg.org/multipage/tables.html#header-and-data-cell-semantics). | ||
|
||
## Assumptions | ||
|
||
_There are currently no assumptions._ | ||
jeeyyy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Accessibility Support | ||
|
||
_There are no major accessibility support issues known for this rule._ | ||
|
||
## Background | ||
|
||
- [Understanding Success Criterion 1.3.1: Information and relationships](https://www.w3.org/WAI/WCAG21/Understanding/info-and-relationships.html) | ||
- [H43: Using id and headers attributes to associate data cells with header cells in data tables](https://www.w3.org/WAI/WCAG21/Techniques/html/H43) | ||
- [Forming relationships between data cells and header cells](https://html.spec.whatwg.org/multipage/tables.html#header-and-data-cell-semantics) | ||
|
||
## Test Cases | ||
jeeyyy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Passed | ||
|
||
#### Passed Example 1 | ||
|
||
The column header element has corresponding cell, within the same `table` element. | ||
|
||
```html | ||
<table> | ||
<tr> | ||
<th>Time</th> | ||
</tr> | ||
<tr> | ||
<td>05:41</td> | ||
</tr> | ||
</table> | ||
``` | ||
|
||
#### Passed Example 2 | ||
|
||
Each column header element has corresponding cells, within the same `table` element. | ||
|
||
```html | ||
<div role="table"> | ||
<div role="rowgroup"> | ||
<div role="row"> | ||
<span role="columnheader">Month</span> | ||
<span role="columnheader">Top Temperature</span> | ||
</div> | ||
</div> | ||
<div role="rowgroup"> | ||
<div role="row"> | ||
<span role="cell">July</span> | ||
<span role="cell">40 C</span> | ||
</div> | ||
<div role="row"> | ||
<span role="cell">August</span> | ||
<span role="cell">45 C</span> | ||
</div> | ||
</div> | ||
</div> | ||
``` | ||
|
||
#### Passed Example 3 | ||
|
||
Each column header element has corresponding cells within the same table element. In this example the column headers have cells that span multiple columns. | ||
|
||
```html | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Projects</th> | ||
<th>Exams</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td colspan="2">15%</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
``` | ||
|
||
#### Passed Example 4 | ||
|
||
Each row and column header element has corresponding cells, within the same element having a [semantic role](#semantic-role) of `grid`. | ||
|
||
```html | ||
jeeyyy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<table role="grid"> | ||
<thead role="rowgroup"> | ||
<tr role="row"> | ||
<td></td> | ||
<th role="columnheader">Breakfast</th> | ||
<th role="columnheader">Lunch</th> | ||
<th role="columnheader">Dinner</th> | ||
</tr> | ||
</thead> | ||
<tbody role="rowgroup"> | ||
<tr role="row"> | ||
<th scope="row" role="rowheader">Day 1</th> | ||
<td>8:00</td> | ||
<td>13:00</td> | ||
<td>18:00</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
``` | ||
|
||
jeeyyy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
### Failed | ||
jeeyyy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### Failed Example 1 | ||
|
||
One of the column headers ("Column 2"), does not have corresponding cell within the same `table` element. | ||
|
||
```html | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Column 1</th> | ||
<th>Column 2</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>15%</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
jeeyyy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
### Inapplicable | ||
|
||
#### Inapplicable Example 1 | ||
|
||
The rule does not apply to table element that is not [included in the accessibility tree](#included-in-the-accessibility-tree). | ||
|
||
```html | ||
<table role="presentation"> | ||
<tr> | ||
<th>Time</th> | ||
</tr> | ||
<tr> | ||
<td>12:00</td> | ||
</tr> | ||
</table> | ||
``` | ||
|
||
#### Inapplicable Example 2 | ||
|
||
The rule does not apply to table element that is not [visible](#visible) in page. | ||
|
||
```html | ||
<html> | ||
<style> | ||
.notInPage { | ||
position: absolute; | ||
left: -9999px; | ||
top: -9999px; | ||
} | ||
</style> | ||
|
||
<body> | ||
<table class="notInPage"> | ||
<tr> | ||
<th>Time</th> | ||
</tr> | ||
<tr> | ||
<td>24:00</td> | ||
</tr> | ||
</table> | ||
</body> | ||
</html> | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.