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

Table headers-id rules refactor #38

Merged
merged 6 commits into from Oct 12, 2017
Merged

Conversation

kensgists
Copy link
Collaborator

Original draft rule was refactored into two rules, one fully automatic and the other semi-automatic. Rules were made to conform with the rule template.

@@ -0,0 +1,131 @@
---
rule_id: SC1-3-1-tables-headers-id-correct
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest removing "-correct" from the title to keep it terse.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a way to differentiate between the two rules -- one "valid," one "correct"


## Description

This rule checks that data table headers-id associations reference correct targets in the correct order.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would this rule work with other rules for testing tables?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In latest pull, I created a dependency on tables-headers-id-valid rule. Seems like there needs to be a first pass that validates the associations in terms of pure conformance to spec (or, maybe this would be caught by the parser?? and there is no need for the tables-headers-id-value rule???)


For each un-marked table, select all elements that match the following CSS selector:

table:not([role=presentation]) th[headers],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following table would match this, even though I don't think that it should:

<table><tr><td>
   <table role="presentation"><tr><td headers="">Matching cell</td></tr></table>
</td></tr></table>

The same is true for the selector in the second rule

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tables are treated in isolation -- loop from innermost out, marking that a table has been checked as you move from table to table. Contents of marked tables is ignored on subsequent loops.

I'm open to a change to the selector if there is a way to exclude nested tables, but I couldn't think of a way to do it in CSS.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth filtering out layout tables first? Or would a more specific selector do this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking for role of presentation or none is one options, but not all authors implement that. HTML 5.1 spec has some guidance on what one can check - https://www.w3.org/TR/2014/WD-html51-20140617/tabular-data.html

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EmmaJP and @cpandhi I changed the rule so that it does a very basic check for the existence of the th[headers] or td[headers] and then just assumes that the author is using these within a data table. Thought this was the simplest approach.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kensgists Where can I find these changes? I want to make sure we've got a PR for this.

| Presented item | Highlight a table cell and the related "header" cell.
| Question | Is the cell appropriately categorized by or semantically related with the associated "header" cell?
| Requires context | Yes. An understanding of the data relationships in the table.
| Requires interaction | Yes. Answering the question allows test to proceed to the next step or iteration.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should only be 'yes' or 'no'.

…ons, on Wilco's comment. Changed rule to conform to HTML 5.1 spec for headers-id references. Added recommended dependency on SC1-3-1-tables-headers-id-valid rule.
@kensgists
Copy link
Collaborator Author

Changes to files address some of @WilcoFiers comments and updates both rules so that headers-id usage conforms to HTML specification.

@WilcoFiers WilcoFiers merged commit 2cbd53e into act-rules:master Oct 12, 2017
@kensgists
Copy link
Collaborator Author

Changes are on the issue and I have pushed them to my fork. File is here: https://github.com/kensgists/auto-wcag/blob/master/_drafts/SC1-3-1-tables-headers-id.md.

Do you want me to do another PR?

Note, that the previous files (tables-headers-id-correct and tables-headers-id-valid) can be removed. They are superseded by this new rule, which merges the other two.

@WilcoFiers
Copy link
Member

Yes, please open a PR. I'll add it to the agenda for Thursday's call.

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

Successfully merging this pull request may close these issues.

None yet

4 participants